button.setSize(scaledImage.getWidth(), scaledImage.getHeight()); button.setToolTipText(navigationButton.getTooltip()); button.setIcon(new ImageIcon(scaledImage));
final JPopupMenu popup = new JPopupMenu(); popup.add(loadFileAction); jbutton.setSize(30, 30); jbutton.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) {
private JButton createTaskButton(Task task) { JButton taskButton = SwingUtils.makeSmallButton(new JButton(new TaskAction(task))); taskButton.setBackground(task.isPinned() ? TangoColorFactory.ALUMINIUM_3 : TangoColorFactory.ALUMINIUM_1); taskButton.setHorizontalTextPosition(SwingConstants.CENTER); taskButton.setVerticalTextPosition(SwingConstants.TOP); taskButton.setSize(task.getDuration(), ROW_HEIGHT); return taskButton; }
private void setTypeIcon(BufferedImage bufferedImage, String toolTipText) { iconPanel = new JPanel(); iconPanel.setLayout(null); iconPanel.setOpaque(false); add(iconPanel); typeButton = new JButton(""); typeButton.setLocation(2, 2); typeButton.setSize(25, 25); iconPanel.setVisible(true); typeButton.setIcon(new ImageIcon(bufferedImage)); if (toolTipText != null) { typeButton.setToolTipText(toolTipText); } iconPanel.add(typeButton); }
@Override public void installUI(JComponent component) { super.installUI(component); JButton button = (JButton)component; button.setSize(new Dimension(17, 16)); button.setOpaque(false); button.setBorderPainted(false); }
public ProgressPanel(final NodeBoxDocument document) { setMinimumSize(new Dimension(0, PROGRESS_PANEL_HEIGHT)); setMaximumSize(new Dimension(PROGRESS_PANEL_WIDTH, PROGRESS_PANEL_HEIGHT)); setPreferredSize(new Dimension(PROGRESS_PANEL_WIDTH, PROGRESS_PANEL_HEIGHT)); setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0)); stopButton = new JButton(stopOffIcon); stopButton.setBorderPainted(false); stopButton.setBorder(null); stopButton.setSize(19, 19); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { document.stopRendering(); } }); add(stopButton); }
public MageFloatPane() { UI.setHTMLEditorKit(this); setEditable(false); setBackground(Color.white); JButton jb = new JButton("Done"); jb.setLocation(50, 50); jb.setSize(100, 50); add(jb); }
dayNightButton.setSize(32, 32); dayNightButton.setToolTipText("This permanent is a double faced card. To see the back face card, push this button or turn mouse wheel down while hovering with the mouse pointer over the permanent."); BufferedImage day = ImageManagerImpl.instance.getDayImage(); showCopySourceButton.setSize(32, 32); showCopySourceButton.setToolTipText("This permanent is copying a target. To see original card, push this button or turn mouse wheel down while hovering with the mouse pointer over the permanent."); showCopySourceButton.setVisible(((PermanentView) this.gameCard).isCopy());
@Override public void setSize(int width, int height) { super.setSize(width, height + 2); } };
public void paintComponent(java.awt.Graphics g){ setBackground(Color.GREEN); // !!!! Graphics2D gr=(Graphics2D) g; for(int x=0;x<Player.hand.size();x++){ // .... etc .... JButton button = new JButton(c.name); // !!!! yikes !!!! button.setSize(c.cardWidth, c.cardHeight); //button.setLocation(c.XCord, c.YCord); this.add(button); // !!!! yikes !!!! repaint(); // !!!! } }
// Create a new button: JButton b1 = new JButton("ok"); // Set the location and size of the button: b1.setSize(100, 26); // Add the button to the window: jPanel1.add(b1); //Repaint the Panel to make visible jPanel1.repaint();
private JButton stdButton(String title, String command) { JButton Button2 = new JButton(title); Button2.setSize(15, 15); Button2.setActionCommand(command); Button2.addActionListener(this); return Button2; }
public static void main(String[] args){ JFrame frame = new JFrame(); JButton b1 = new JButton(); frame.setSize(500,500); b1.setSize(400,400); b1.setVisible(true); b1.setText("HelloWorld"); frame.add(b1); frame.setVisible(true); }//SSCCE1
public void createButton(int x, int y, String s) { try { JButton btn1 = new JButton(s); jPanel1.add(btn1); btn1.setLocation(x, y); btn1.setSize(50, 50); btn1.setVisible(true); } catch (Exception e) { e.printStackTrace(); System.out.println(e); } }
private void configureButton(JButton button, String icon, String tooltip) { button.setIcon(new ImageIcon(ListSelector.class.getResource(icon))); button.setToolTipText(tooltip); button.setPreferredSize(BUTTON_SIZE); button.setSize(BUTTON_SIZE); button.setMaximumSize(BUTTON_SIZE); button.setMinimumSize(BUTTON_SIZE); }
private static void forceSize(JButton button) { button.setMaximumSize(new Dimension(70, 24)); button.setMinimumSize(new Dimension(70, 24)); button.setSize(new Dimension(70, 24)); button.setPreferredSize(new Dimension(70, 24)); }
JButton scoreButton =new JButton("add"); scoreButton.setSize(100, 50); scoreButton.setLocation(100,50); scoreButton.setBackground(Color.red); scoreButton.addActionListener(this); MyPanel.add(scoreButton);
private JButton createRemoveTagButton(StreamTag tag) { JButton removeButton = new JButton(REMOVE_ICON); removeButton.setToolTipText(Language.getString("admin.tags.button.remove.tip", tag.toString())); removeButton.setMargin(new Insets(0, 0, 0, 0)); removeButton.setSize(10, 10); removeButton.addActionListener(e -> { current.remove(tag); updateCurrent(); }); removeButton.setEnabled(tag.isValid()); return removeButton; }
int buttonHeight = 10; int buttonWidth = 10; for (int i = 0; i < 10; i++) { JButton button = new Button("Button " + i); button.setSize(buttonWidth, buttonHeight); button.setLocation(10 + i * buttonWidth, 10); getContentPane().add(button); }
private JButton createTaskButton(Task task) { JButton taskButton = SwingUtils.makeSmallButton(new JButton(new TaskAction(task))); taskButton.setBackground(task.isPinned() ? TangoColorFactory.ALUMINIUM_3 : TangoColorFactory.ALUMINIUM_1); taskButton.setHorizontalTextPosition(SwingConstants.CENTER); taskButton.setVerticalTextPosition(SwingConstants.TOP); taskButton.setSize(task.getDuration(), ROW_HEIGHT); return taskButton; }