本文整理了Java中javax.swing.JButton.setSize()
方法的一些代码示例,展示了JButton.setSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setSize()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setSize
暂无
代码示例来源:origin: runelite/runelite
button.setSize(scaledImage.getWidth(), scaledImage.getHeight());
button.setToolTipText(navigationButton.getTooltip());
button.setIcon(new ImageIcon(scaledImage));
代码示例来源:origin: org.codehaus.groovy/groovy
final JPopupMenu popup = new JPopupMenu();
popup.add(loadFileAction);
jbutton.setSize(30, 30);
jbutton.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
代码示例来源:origin: kiegroup/optaplanner
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;
}
代码示例来源:origin: magefree/mage
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);
}
代码示例来源:origin: tomighty/tomighty
@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);
}
代码示例来源:origin: nodebox/nodebox
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);
}
代码示例来源:origin: magefree/mage
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);
}
代码示例来源:origin: magefree/mage
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());
代码示例来源:origin: lbalazscs/Pixelitor
@Override
public void setSize(int width, int height) {
super.setSize(width, height + 2);
}
};
代码示例来源:origin: stackoverflow.com
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(); // !!!!
}
}
代码示例来源:origin: stackoverflow.com
// 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();
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
private JButton stdButton(String title, String command) {
JButton Button2 = new JButton(title);
Button2.setSize(15, 15);
Button2.setActionCommand(command);
Button2.addActionListener(this);
return Button2;
}
代码示例来源:origin: stackoverflow.com
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
代码示例来源:origin: stackoverflow.com
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);
}
}
代码示例来源:origin: chatty/chatty
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);
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
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));
}
代码示例来源:origin: stackoverflow.com
JButton scoreButton =new JButton("add");
scoreButton.setSize(100, 50);
scoreButton.setLocation(100,50);
scoreButton.setBackground(Color.red);
scoreButton.addActionListener(this);
MyPanel.add(scoreButton);
代码示例来源:origin: chatty/chatty
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;
}
代码示例来源:origin: stackoverflow.com
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);
}
代码示例来源:origin: org.optaplanner/optaplanner-examples
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;
}
内容来源于网络,如有侵权,请联系作者删除!