List of usage examples for javax.swing JPanel JPanel
public JPanel()
JPanel
with a double buffer and a flow layout. From source file:Main.java
public static JPanel embed(Component comp) { JPanel pan = new JPanel(); pan.add(comp); return pan; }
From source file:Main.java
public static JPanel getPanelFlowLayoutHorizontal(int w, int h, int type) { JPanel panel = new JPanel(); FlowLayout layout = new FlowLayout(); layout.setAlignment(type);// w ww . jav a 2 s . c om panel.setLayout(layout); panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); panel.setPreferredSize(getControlDimension(w, h)); panel.setMinimumSize(getControlDimension(w, h)); return panel; }
From source file:Main.java
private static JPanel createLogin() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); JLabel label = new JLabel("login panel."); label.setFont(label.getFont().deriveFont(Font.ITALIC, 24f)); label.setAlignmentX(0.5f);/*from w ww . j ava 2 s . co m*/ label.setBorder(new EmptyBorder(0, 20, 0, 20)); p.add(Box.createVerticalStrut(36)); p.add(label); p.add(Box.createVerticalStrut(144)); return p; }
From source file:Main.java
private static JPanel createPanel() { JPanel panel = new JPanel(); final JLabel label = new JLabel(new Date().toString()); panel.add(label);/*from ww w . ja v a 2 s . c om*/ panel.addAncestorListener(new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { // start animation label.setText(new Date().toString()); } @Override public void ancestorRemoved(AncestorEvent event) { // stop animation } @Override public void ancestorMoved(AncestorEvent event) { } }); return panel; }
From source file:AlignX.java
private static Container makeIt(String labelChar, float alignment) { JPanel container = new JPanel(); BoxLayout layout = new BoxLayout(container, BoxLayout.Y_AXIS); container.setLayout(layout);//w w w. j a v a 2s . c o m for (int i = 1; i < 6; i++) { String label = makeLabel(labelChar, i * 2); JButton button = new JButton(label); button.setAlignmentX(alignment); container.add(button); } return container; }
From source file:Main.java
public static JPanel getComponentColumn(JComponent[] components) { JPanel columnPanel = new JPanel(); columnPanel.setLayout(new BoxLayout(columnPanel, BoxLayout.PAGE_AXIS)); for (int i = 0; i < components.length; i++) { components[i].setMinimumSize(new Dimension(components[i].getPreferredSize().width, ROW_HEIGHT)); components[i].setPreferredSize(new Dimension(components[i].getPreferredSize().width, ROW_HEIGHT)); components[i].setMaximumSize(new Dimension(components[i].getPreferredSize().width, ROW_HEIGHT)); components[i].setAlignmentX(JComponent.LEFT_ALIGNMENT); columnPanel.add(components[i]);/*from www .j a v a 2s .co m*/ } return columnPanel; }
From source file:MainClass.java
static void addIt(JTabbedPane tabbedPane, String text) { JLabel label = new JLabel(text); JButton button = new JButton(text); JPanel panel = new JPanel(); panel.add(label);/* ww w.java 2s.c o m*/ panel.add(button); tabbedPane.addTab(text, panel); }
From source file:Main.java
/** * @return a JPanel containing a label with the specified String as its text, and the component. *///from www. java2 s. co m public static JPanel labelComponent(JComponent c, String s) { JPanel panel = new JPanel(); panel.add(new JLabel(s)); panel.add(c); return panel; }
From source file:Main.java
/** * Returns a "warning"-colored panel with given message. * /*from w w w. j ava 2 s. co m*/ * @param context * @param message * @return */ public static JPanel constructWarningPanel(String message) { JPanel p = new JPanel(); JLabel l = new JLabel(message); // "magical" color p.setBackground(new Color(240, 40, 70)); p.add(l); return p; }
From source file:TabSample.java
static void addIt(JTabbedPane tabbedPane, String text) { JLabel label = new JLabel(text); JButton button = new JButton(text); JPanel panel = new JPanel(); panel.add(label);/*w w w . j a v a 2 s .co m*/ panel.add(button); tabbedPane.addTab(text, panel); tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, new JTextField(text)); }