List of utility methods to do JLabel Create
JPanel | createCenteredLabel(JLabel label) create Centered Label return createLineBoxPanel(Box.createHorizontalGlue(), label, Box.createHorizontalGlue());
|
JPanel | createFormPanel(JLabel label, JComponent component) create Form Panel JPanel p = new JPanel(); p.setLayout(new BorderLayout(4, 4)); label.setLabelFor(component); p.add(label, BorderLayout.WEST); p.add(component, BorderLayout.CENTER); return p; |
JLabel | createJLabel(Container c, String caption, int x, int y) This method makes it easy (and also neat) creating a JLabel and adding it to its container class.
FontMetrics fm = c.getFontMetrics(c.getFont()); JLabel lbl = new JLabel(caption); lbl.setBounds(x, y, fm.stringWidth(caption) + 20, 20); c.add(lbl); return lbl; |
JLabel | createJLabel(final String text, final Font font, final Color color) Creates a label with a specific font and color. final JLabel result = new JLabel(text); result.setFont(font); result.setForeground(color); return result; |
JLabel | createJLabel(String mlabel) Create a JLabel but make the font plain instead of super ugly BOLD JLabel l = new JLabel(mlabel, SwingConstants.LEFT); setFontType(l, Font.PLAIN); return l; |
JLabel | createJLabel(String text, Font font) Creates a label with a specific font. JLabel result = new JLabel(text); result.setFont(font); return result; |
JLabel | createJLabel(String text, Font font) Creates a label with a specific font. JLabel result = new JLabel(text); result.setFont(font); return result; |
JLabel | createLabel(String name, int x, int y, int width, int height, Font font) create Label JLabel label = new JLabel(name); label.setBounds(x, y, width, height); if (font != null) { label.setFont(font); return label; |
JLabel | createLabel(String text, Font f) create Label JLabel newLab = new JLabel(text); newLab.setBackground(BG_COLOR); newLab.setFont(f); newLab.setForeground(DARK_GREEN_COLOR); return newLab; |
JLabel | createLabel(String text, Font f, Color c, int position) create Label JLabel newLab = new JLabel(text, position); newLab.setBackground(BG_COLOR); newLab.setFont(f); newLab.setForeground(c); return newLab; |