List of usage examples for java.awt BorderLayout LINE_END
String LINE_END
To view the source code for java.awt BorderLayout LINE_END.
Click Source Link
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel("Hello"); label.setOpaque(true);//from w w w. ja va 2 s.c o m label.setBackground(Color.red); JPanel bottomPanel = new JPanel(new BorderLayout()); bottomPanel.add(label, BorderLayout.LINE_END); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(bottomPanel, BorderLayout.PAGE_END); mainPanel.setPreferredSize(new Dimension(400, 400)); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel outerPanel = new JPanel(new BorderLayout()); JPanel topPanel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Name:"); JTextField text = new JTextField(); topPanel.add(label, BorderLayout.LINE_END); topPanel.add(text, BorderLayout.CENTER); outerPanel.add(topPanel, BorderLayout.AFTER_LAST_LINE); frame.add(outerPanel);//from w w w . ja v a 2 s .c om frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JPanel ui = new JPanel(new BorderLayout(2, 2)); ui.setBorder(new EmptyBorder(4, 4, 4, 4)); JPanel controls = new JPanel(new BorderLayout(2, 2)); ui.add(controls, BorderLayout.PAGE_START); String s = new String(Character.toChars(8594)); String[] items = { "Choice: right " + s + " arrow" }; JComboBox cb = new JComboBox(items); controls.add(cb, BorderLayout.CENTER); controls.add(new JButton("Button"), BorderLayout.LINE_END); JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JTextArea(4, 40), new JTextArea(4, 40)); ui.add(sp, BorderLayout.CENTER); JFrame f = new JFrame("Stretch Combo Layout"); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setContentPane(ui);/* w w w .j av a 2 s . c om*/ f.pack(); f.setLocationByPlatform(true); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JPanel gui = new JPanel(new BorderLayout(5, 5)); int sz = 4;/* w w w . ja va 2 s . c om*/ Container content = new JPanel(new GridLayout(sz, 0, 2, 2)); for (int f = 0; f < sz * sz; f++) { content.add(new JButton()); } gui.add(content, BorderLayout.CENTER); Container info = new JPanel(new FlowLayout(FlowLayout.CENTER, 50, 5)); info.add(new JLabel("Flow")); info.add(new JLabel("Layout")); gui.add(info, BorderLayout.PAGE_START); gui.add(new JLabel("Label"), BorderLayout.LINE_END); JOptionPane.showMessageDialog(null, gui); }
From source file:Main.java
public static void main(String[] args) throws Exception { URL url = new URL("http://www.java2s.com/style/download.png"); final BufferedImage image = ImageIO.read(url); int x = 50;//from w ww . j ava 2s.c o m final Image crop = image.getSubimage(x, 0, image.getWidth() - x, image.getHeight()); Runnable r = new Runnable() { @Override public void run() { JPanel gui = new JPanel(); gui.add(new JLabel(new ImageIcon(image)), BorderLayout.LINE_START); gui.add(new JLabel("java2s.com")); gui.add(new JLabel(new ImageIcon(crop)), BorderLayout.LINE_END); JOptionPane.showMessageDialog(null, gui); } }; SwingUtilities.invokeLater(r); }
From source file:Main.java
public static void main(String[] args) { showFrameWithToolBar(BorderLayout.PAGE_START); showFrameWithToolBar(BorderLayout.PAGE_END); showFrameWithToolBar(BorderLayout.LINE_START); showFrameWithToolBar(BorderLayout.LINE_END); showFrameWithToolBar(BorderLayout.CENTER); }
From source file:Main.java
public static void main(String[] args) { JPanel gui = new JPanel(new BorderLayout()); gui.setBorder(new EmptyBorder(2, 3, 2, 3)); JPanel textPanel = new JPanel(new BorderLayout(5, 5)); textPanel.add(new JScrollPane(new JTextArea("Top Text", 3, 20)), BorderLayout.PAGE_START); textPanel.add(new JScrollPane(new JTextArea("Main Text", 10, 10))); gui.add(textPanel, BorderLayout.CENTER); JPanel buttonCenter = new JPanel(new GridBagLayout()); buttonCenter.setBorder(new EmptyBorder(5, 5, 5, 5)); JPanel buttonPanel = new JPanel(new GridLayout(0, 1, 5, 5)); for (int ii = 1; ii < 6; ii++) { buttonPanel.add(new JButton("Button " + ii)); }/*from w ww . j av a2 s. c o m*/ buttonCenter.add(buttonPanel); gui.add(buttonCenter, BorderLayout.LINE_END); JFrame f = new JFrame("Demo"); f.add(gui); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setLocationByPlatform(true); f.pack(); f.setVisible(true); }
From source file:Main.java
private void display() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new JButton(new AbstractAction("<Prev") { @Override/*www.ja v a 2s . co m*/ public void actionPerformed(ActionEvent e) { if (--index < 0) { index = list.size() - 1; } update(); } }), BorderLayout.LINE_START); f.add(label); f.add(new JButton(new AbstractAction("Next>") { @Override public void actionPerformed(ActionEvent e) { if (++index == list.size()) { index = 0; } update(); } }), BorderLayout.LINE_END); f.pack(); f.setVisible(true); }
From source file:Main.java
public Main() { super(new BorderLayout()); amountDisplayFormat = NumberFormat.getCurrencyInstance(); System.out.println(amountDisplayFormat.format(1200)); amountDisplayFormat.setMinimumFractionDigits(0); amountEditFormat = NumberFormat.getNumberInstance(); amountField = new JFormattedTextField(new DefaultFormatterFactory(new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountEditFormat))); amountField.setValue(new Double(amount)); amountField.setColumns(10);//from ww w . j a va2s . co m amountField.addPropertyChangeListener("value", this); JPanel fieldPane = new JPanel(new GridLayout(0, 1)); fieldPane.add(amountField); add(fieldPane, BorderLayout.LINE_END); add(new JButton("Hello"), BorderLayout.SOUTH); }
From source file:layout.BorderLayoutDemo.java
public static void addComponentsToPane(Container pane) { if (!(pane.getLayout() instanceof BorderLayout)) { pane.add(new JLabel("Container doesn't use BorderLayout!")); return;/*from ww w . j av a2 s. c o m*/ } if (RIGHT_TO_LEFT) { pane.setComponentOrientation(java.awt.ComponentOrientation.RIGHT_TO_LEFT); } JButton button = new JButton("Button 1 (PAGE_START)"); pane.add(button, BorderLayout.PAGE_START); //Make the center component big, since that's the //typical usage of BorderLayout. button = new JButton("Button 2 (CENTER)"); button.setPreferredSize(new Dimension(200, 100)); pane.add(button, BorderLayout.CENTER); button = new JButton("Button 3 (LINE_START)"); pane.add(button, BorderLayout.LINE_START); button = new JButton("Long-Named Button 4 (PAGE_END)"); pane.add(button, BorderLayout.PAGE_END); button = new JButton("5 (LINE_END)"); pane.add(button, BorderLayout.LINE_END); }