List of usage examples for java.awt BorderLayout BorderLayout
public BorderLayout()
From source file:Main.java
public Main() throws HeadlessException { setBounds(10, 10, 600, 400);//from ww w . ja v a2 s. c o m setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new BorderLayout()); add(createDesktop(), BorderLayout.CENTER); addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent e) { internalFrame.setVisible(true); } }); setVisible(true); }
From source file:MainClass.java
public MainClass() { JButton btn1 = new JButton("Button1"); JButton btn2 = new JButton("Button2"); JButton btn3 = new JButton("Button3"); JButton btn4 = new JButton("Button4"); JButton btn5 = new JButton("Button5"); JButton btn6 = new JButton("Button6"); setLayout(new BorderLayout()); add("North", btn1); add("West", btn2); add("Center", btn3); add("Center", btn4); add("South", btn5); add("East", btn6); }
From source file:projects.hip.exec.HrDiagram.java
/** * Main application entry point.//from w w w .j av a 2s. c o m * @param args * The args - ignored. */ public static void main(String[] args) { final JFrame frame = new JFrame("Hipparcos HR diagram"); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new HrDiagram(), BorderLayout.CENTER); frame.setSize(1500, 750); frame.pack(); frame.setVisible(true); } }); }
From source file:JTable2Pdf.java
public JTable2Pdf() { getContentPane().setLayout(new BorderLayout()); createTable(); }
From source file:Main.java
private void go() { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel topPanel = new JPanel(); topPanel.add(new JLabel("boo")); JPanel mainPanel = new JPanel(new BorderLayout()); JPanel mainInnerPanel = makeMainInnerPanel(); JScrollPane scrollPane = new JScrollPane(mainInnerPanel); mainPanel.add(scrollPane);/*from w w w . j a v a 2s .c o m*/ add(topPanel, BorderLayout.NORTH); add(mainPanel, BorderLayout.CENTER); pack(); setVisible(true); }
From source file:Main.java
public Main() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack();// w w w.ja v a 2 s .c o m frame.setVisible(true); }
From source file:Main.java
public Main(final Frame owner) { super(owner); JPanel pnl = new JPanel(new BorderLayout()); pnl.add(new JLabel("Click outside this dialog in the parent frame to close it"), BorderLayout.NORTH); JButton btn = new JButton("Click Me"); btn.addActionListener(e -> JOptionPane.showMessageDialog(Main.this, "New Child Window")); pnl.add(btn, BorderLayout.CENTER); this.setContentPane(pnl); this.pack();/* w w w .j a v a 2s . co m*/ this.setLocationRelativeTo(owner); this.setAlwaysOnTop(true); this.addWindowFocusListener(new WindowFocusListener() { public void windowGainedFocus(WindowEvent e) { } public void windowLostFocus(WindowEvent e) { if (SwingUtilities.isDescendingFrom(e.getOppositeWindow(), Main.this)) { return; } Main.this.setVisible(false); } }); }
From source file:SampleButton.java
public SampleButton() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel(new BorderLayout()); p.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JButton b = new JButton("Test"); b.setHorizontalTextPosition(SwingConstants.LEFT); b.setIcon(new ImageIcon("r.gif")); b.setRolloverIcon(new ImageIcon("b.gif")); b.setRolloverEnabled(true);/*from w ww .jav a 2 s . c o m*/ b.setMnemonic('t'); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Button pressed"); } }); p.add(b); getContentPane().add(p); pack(); }
From source file:Main.java
public Main() { super(new BorderLayout()); textArea.setEditable(false);/*w w w. j a v a2 s. c o m*/ scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(400, 250)); add(scrollPane, BorderLayout.CENTER); textArea.addMouseWheelListener(this); setPreferredSize(new Dimension(450, 350)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:Main.java
public Main() { setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(400, 400);/* w w w . jav a 2 s .c om*/ JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT); split.setDividerLocation(200); add(split); JPanel panel1 = new JPanel(); panel1.setLayout(new BorderLayout()); panel1.add(new JLabel("top panel"), BorderLayout.NORTH); JPanel myDrawPanel = new JPanel(); myDrawPanel.setPreferredSize(new Dimension(100, 100)); myDrawPanel.add(new JLabel("draw panel here!")); panel1.add(new JScrollPane(myDrawPanel), BorderLayout.CENTER); split.setTopComponent(panel1); JPanel panel2 = new JPanel(); panel2.add(new JLabel("bottom panel")); split.setBottomComponent(panel2); setVisible(true); }