本文整理了Java中javax.swing.JLabel.add()
方法的一些代码示例,展示了JLabel.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.add()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:add
暂无
代码示例来源: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
JLabel label = new JLabel( new ImageIcon(...) );
frame.add(label);
label.setLayout(....);
label.add(leaveButton);
label.add(labelWithText);
label.add(stayButton);
代码示例来源: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 mycontainer = new JLabel();
container.setLayout(new BoxLayout(mycontainer, BoxLayout.X_AXIS));
JLabel icon1Label = new JLabel();
JLabel icon2Label = new JLabel();
icon1Label.setIcon(icon1);
icon2Label.setIcon(icon2);
mycontainer.add(icon1Label);
mycontainer.add(icon2Label);
代码示例来源:origin: stackoverflow.com
public void initcomp(JFrame parent){
JPanel panel = new JPanel();
JLabel label1 = new JLabel("hekllo");
label1.add(panel);
panel.add(parent);
代码示例来源: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
JLabel character = new JLabel(...);
character.setSize( character.getPreferredSize() );
JLabel background = new JLabel(...);
background.add( character );
frame.add( background );
代码示例来源:origin: stackoverflow.com
JPanel center = new JPanel( new GridBagLayout() );
frame.add(center, BorderLayout.CENTER);
JLabel background = new JLabel(...);
background.setLayoutManager( new GridBagLayout() );
center.add(background, new GridBagConstraints());
background.add(yourCardPanel, new GridBagConstraints());
代码示例来源: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
BufferedImage rangerIm = ImageIO.read(new File("src/Images/Sprites/Ranger.png"));
JLabel ranger = new JLabel( new ImageIcon(rangerIm) );
ranger.setSize( ranger.getPreferredSize() );
BufferedImage backgroundIm = Bg = ImageIO.read(new File("src/Images/BG.png"));
JLabel background = new JLabel( new ImageIcon(rangerIm) );
background.add( ranger );
f.add(background, BorderLayout.CENTER);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setResizable(false);
f.pack();
f.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 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
JButton button = new JButton("Text or Image");
JLabel backgr = new JLabel();
JFrame frame = new JFrame("JLabel as Layout");
button.setBounds(100, 200, 340, 40);
backgr.add(button);
frame.add(backgr);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(600, 600);
frame.setLocation(40, 40);
frame.validate();
frame.setVisible(true);
代码示例来源: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
JTextField textField = new JTextField(10);
textField.setOpaque( false );
JLabel label = new JLabel( new ImageIcon(...) );
label.setLayout( new BorderLayout() );
label.add( textField );
代码示例来源: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
ImageIcon imageIcon = new ImageIcon("src\\SwingExp\\img\\map.gif");
JLabel map = new JLabel( imageIcon );
JScrollPane scrollPane = new JScrollPane( map );
//JScrollPane scrollPane = new JScrollPane(new JLabel(imageIcon));
scrollPane.setBounds(5,5,600,400);
JLabel usaLabel = new JLabel("U.S.A.");
usaLabel.setBounds(210,200,50,25);
map.add( usaLabel );
//mapPanel.add(usaLabel);
代码示例来源:origin: stackoverflow.com
JCalendar calendar = new JCalendar();
JLabel label = new JLabel("Select date of birth:");
label.setLayout(new BorderLayout());
label.add(calendar, BorderLayout.EAST);
内容来源于网络,如有侵权,请联系作者删除!