List of usage examples for java.awt BorderLayout NORTH
String NORTH
To view the source code for java.awt BorderLayout NORTH.
Click Source Link
From source file:Main.java
/** * Creates a JPanel containing the component hugging the top side * @param component the component to wrap * @return a JPanel containing the component hugging the top side *//*from w w w . j a v a 2 s . c o m*/ public static JPanel hugNorth(JComponent component) { final JPanel result = new JPanel(new BorderLayout()); result.add(component, BorderLayout.NORTH); return result; }
From source file:Main.java
public static JPanel createVerticalPanel(Component topCmp, Component centerCmp) { JPanel outPane = new JPanel(); outPane.setLayout(new BorderLayout()); outPane.setBorder(new EmptyBorder(5, 5, 5, 5)); outPane.add(topCmp, BorderLayout.NORTH); outPane.add(centerCmp, BorderLayout.CENTER); return outPane; }
From source file:Main.java
public static JPanel createTextComponentPane(String labelText, JTextComponent textComp, Font font, Color bgColor, boolean isVertical) { JPanel outPane = new JPanel(); outPane.setLayout(new BorderLayout()); outPane.setBorder(new EmptyBorder(5, 5, 5, 5)); JLabel labelOut = new JLabel(labelText, SwingConstants.LEFT); if (isVertical) { outPane.add(labelOut, BorderLayout.NORTH); } else {/*from ww w . ja v a2 s . com*/ outPane.add(labelOut, BorderLayout.WEST); } if (textComp instanceof JTextArea) { outPane.add(createScrollPane((JTextArea) textComp, font, bgColor), BorderLayout.CENTER); } else { textComp.setBackground(bgColor); textComp.setFont(font); outPane.add(textComp, BorderLayout.CENTER); } return outPane; }
From source file:Main.java
/** * Creates a panel that contains all of the components on top of each other in north, * and tries to make them as small as possible (probably by using getPreferredSize()). * * @deprecated use proper layout, usually no need to use such complex/ugly layouting *//* w ww . ja va2s. co m*/ public static JPanel combineInNorth(JComponent[] components) { JPanel result = new JPanel(); if (components.length == 0) { return result; } result.setLayout(new BorderLayout()); JPanel contentPanel = new JPanel(); result.add(contentPanel, BorderLayout.NORTH); contentPanel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; for (int i = 0; i < components.length; i++) { contentPanel.add(components[i], constraints); } if (result.isVisible()) result.doLayout(); return result; }
From source file:Main.java
public Main() { add(createPanel(), BorderLayout.NORTH); }
From source file:Main.java
public void init() { setLayout(new BorderLayout()); add(BorderLayout.NORTH, m_titleLabel); }
From source file:DropTest14.java
public DropTest14() { super("Drop Test 1.4"); setSize(300, 300);//ww w . jav a2 s . c om setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().add(new JLabel("Drop the choice from your JList here:"), BorderLayout.NORTH); ta = new JTextArea(); ta.setBackground(Color.white); getContentPane().add(ta, BorderLayout.CENTER); setVisible(true); }
From source file:Main.java
public Main(String title) { super(title); north = new Button("North"); south = new Button("South"); east = new Button("East"); west = new Button("West"); center = new Button("Center"); this.add(north, BorderLayout.NORTH); this.add(south, BorderLayout.SOUTH); this.add(east, BorderLayout.EAST); this.add(west, BorderLayout.WEST); this.add(center, BorderLayout.CENTER); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); JPanel east = new JPanel(new BorderLayout()); add(east, BorderLayout.EAST); BasicArrowButton north = new BasicArrowButton(BasicArrowButton.NORTH); east.add(north, BorderLayout.NORTH); BasicArrowButton south = new BasicArrowButton(BasicArrowButton.SOUTH); east.add(south, BorderLayout.SOUTH); }
From source file:Main.java
public Main() { label = new JLabel("Select a Customer"); add(label, BorderLayout.NORTH); Customer customers[] = new Customer[6]; customers[0] = new Customer("A", 1); customers[1] = new Customer("B", 6); customers[2] = new Customer("C", 2); customers[3] = new Customer("D", 3); customers[4] = new Customer("E", 4); customers[5] = new Customer("F", 5); combo = new JComboBox(customers); combo.addItemListener(e -> {//from www.j ava 2 s. co m Customer c = (Customer) e.getItem(); label.setText("You selected customer id: " + c.getId()); }); JPanel panel = new JPanel(); panel.add(combo); add(panel, BorderLayout.CENTER); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 200); setVisible(true); }