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);
private void addPanel() { setTitle("RuneRebellionV2 Launcher"); JLabel label = new JLabel(Settings.background); setContentPane(label); label.setLayout(new BorderLayout());
JLabel background = new JLabel(new ImageIcon("C:/User/Desktop/Assignment/bg.jpg")); con.add(background); background.setLayout(new FlowLayout()); con.add(button);
//jf.setLayout(new FlowLayout()); JLabel background = new JLabel(new ImageIcon("imageprova.jpg")); background.setLayout( new FlowLayout() ); jf.setContentPane( background );
ImageIcon icon = new ImageIcon(getClass().getResource("/Pictures/Brg800.jpg")); JLabel label = new JLabel(icon); label.setLayout(new BorderLayout()); frame.setContentPane(label);
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 );
JLabel background = new JLabel( new ImageIcon(...) ); background.setLayout( new GridBagLayout() ); JPanel buttons = new JPanel(); buttons.setOpaque( false ); buttons.add(...); background.add(buttons, new GridBagConstraints() );
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 );
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 );
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);
JLabel label = new JLabel(...); label.setLayout( new FlowLayout() ); JButton button = new JButton(...); label.add( button ); frame.add(label); frame.pack(); frame.setVisible(true);
JTextField textField = new JTextField(10); textField.setOpaque( false ); JLabel label = new JLabel( new ImageIcon(...) ); label.setLayout( new BorderLayout() ); label.add( textField );
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 );
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);
JTextField field = new JTextField(); field.setOpaque(false); JLabel label = new JLabel(); label.setIcon(...); label.setLayout(new BorderLayout()); label.add(field);
JTextField textField = new JTextField(10); textField.setOpaque( false ); JLabel label = new JLabel( new ImageIcon(...) ); label.setLayout( new BorderLayout() ); label.add( textField );
JCalendar calendar = new JCalendar(); JLabel label = new JLabel("Select date of birth:"); label.setLayout(new BorderLayout()); label.add(calendar, BorderLayout.EAST);
... 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
JLabel label = new JLabel(new ImageIcon("images/Spacebackground.png")); label.setLayout(new FlowLayout()); label.add(startButton); label.add(highScoreButton); label.add(optionsButton); add(label);
JLabel label = new JLabel( new ImageIcon(...) ); frame.add(label); label.setLayout(....); label.add(leaveButton); label.add(labelWithText); label.add(stayButton);