javax.swing.JLabel.setLayout()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(318)

本文整理了Java中javax.swing.JLabel.setLayout()方法的一些代码示例,展示了JLabel.setLayout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.setLayout()方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:setLayout

JLabel.setLayout介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JLabel container = new JLabel();
container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
JLabel icon1Label = new JLabel();
JLabel icon2Label = new JLabel();
icon1Label.setIcon(icon1);
icon2Label.setIcon(icon2);
container.add(icon1Label);
container.add(icon2Label);

代码示例来源:origin: stackoverflow.com

private void addPanel() {
 setTitle("RuneRebellionV2 Launcher");
 JLabel label = new JLabel(Settings.background);
 setContentPane(label);
 label.setLayout(new BorderLayout());

代码示例来源:origin: stackoverflow.com

JLabel background = new JLabel(new ImageIcon("C:/User/Desktop/Assignment/bg.jpg"));
con.add(background);
background.setLayout(new FlowLayout());
con.add(button);

代码示例来源:origin: stackoverflow.com

//jf.setLayout(new FlowLayout());
JLabel background = new JLabel(new ImageIcon("imageprova.jpg"));
background.setLayout( new FlowLayout() );
jf.setContentPane( background );

代码示例来源:origin: stackoverflow.com

ImageIcon icon = new ImageIcon(getClass().getResource("/Pictures/Brg800.jpg"));
JLabel label = new JLabel(icon);
label.setLayout(new BorderLayout());
frame.setContentPane(label);

代码示例来源:origin: stackoverflow.com

JLabel background = new JLabel(....);
background.setLayout( new FlowLayout() );

JLabel foreground = new JLabel(...);
background.add( foreground );

frame.add(background, BorderLayout.CENTER);
frame.pack();
frame.setVisible( true );

代码示例来源:origin: stackoverflow.com

JLabel background = new JLabel( new ImageIcon(...) );
background.setLayout( new GridBagLayout() );
JPanel buttons = new JPanel();
buttons.setOpaque( false );
buttons.add(...);
background.add(buttons, new GridBagConstraints() );

代码示例来源:origin: stackoverflow.com

JLabel background = new JLabel(new ImageIcon("C:/User/Desktop/Assignment/bg.jpg"));
con.add(background);
background.setLayout(new FlowLayout());
//con.add(button);
background.add( button );

代码示例来源:origin: stackoverflow.com

JLabel label = new JLabel( new ImageIcon(...) );
label.setLayout( new FlowLayout() );
JTextField textField = new JTextField(20);
label.add( textField );

JFrame frame = new JFrame();
frame.add(label, BorderLayout.CENTER);
frame.pack();
frame.setVisible( true );

代码示例来源:origin: stackoverflow.com

JLabel outer = new JLabel();
outer.setLayout(new BorderLayout(0,0));
/** Add inner JLabels here. The other you add them is the order they will appear from to right**/
JPanel bookshelf = new JPanel();
bookshelf.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
//Add your jlabels to the bookshelf
outer.add(bookshelf, BorderLayout.SOUTH);

代码示例来源:origin: stackoverflow.com

JLabel label = new JLabel(...);
label.setLayout( new FlowLayout() );
JButton button = new JButton(...);
label.add( button );
frame.add(label);
frame.pack();
frame.setVisible(true);

代码示例来源:origin: stackoverflow.com

JTextField textField = new JTextField(10);
textField.setOpaque( false );
JLabel label = new JLabel( new ImageIcon(...) );
label.setLayout( new BorderLayout() );
label.add( textField );

代码示例来源:origin: stackoverflow.com

JLabel background = new JLabel( new ImageIcon(...) );
background.setLayout( new BorderLayout() );

SimpleArithmeticCalculator calc = new SimpleArithmeticCalculator();  
background.add( calc );

JFrame frame = new JFrame(...);
frame.add( background );
frame.pack();
frame.setVisible( true );

代码示例来源:origin: stackoverflow.com

JPanel panel = new JPanel();
JLabel label = new JLabel( new ImageIcon(...) );
label.setLayout( new FlowLayout() );
JButton button1 = new JButton("Button1");
label.add(button1);
JButton button2 = new JButton("Button1");
label.add(button2);

代码示例来源:origin: stackoverflow.com

JTextField field = new JTextField();
field.setOpaque(false);
JLabel label = new JLabel();
label.setIcon(...);
label.setLayout(new BorderLayout());
label.add(field);

代码示例来源:origin: stackoverflow.com

JTextField textField = new JTextField(10);
textField.setOpaque( false );
JLabel label = new JLabel( new ImageIcon(...) );
label.setLayout( new BorderLayout() );
label.add( textField );

代码示例来源:origin: stackoverflow.com

JCalendar calendar = new JCalendar();        
JLabel label = new JLabel("Select date of birth:");
label.setLayout(new BorderLayout());
label.add(calendar, BorderLayout.EAST);

代码示例来源:origin: stackoverflow.com

...
 ImageIcon icon = new ImageIcon(img);   // your map background as icon
 JLabel label = new JLabel(icon);    // your map background label
 label.setLayout(null);
 JLabel dot = new JLabel(new ImageIcon(redDot));  // you need to put some content in your dot label - like 
 frame.add(label);
 Graphics2D g = (Graphics2D) img.getGraphics();
 label.add(dot);
 //  dot.setLocation(1000, 300);     // when you use setBounds, you don't need location
 dot.setBounds(50, 50, 60, 60);  // x-location, y-location, with, height
 dot.revalidate();   // just to make sure that your dot actually takes the new bounds and paints it

代码示例来源:origin: stackoverflow.com

JLabel label = new JLabel(new ImageIcon("images/Spacebackground.png"));
 label.setLayout(new FlowLayout());
 label.add(startButton);
 label.add(highScoreButton);
 label.add(optionsButton);
 add(label);

代码示例来源:origin: stackoverflow.com

JLabel label = new JLabel( new ImageIcon(...) );
frame.add(label);

label.setLayout(....);
label.add(leaveButton);
label.add(labelWithText);
label.add(stayButton);

相关文章

JLabel类方法