List of usage examples for javax.swing BorderFactory createLineBorder
public static Border createLineBorder(Color color, int thickness)
From source file:Main.java
public static void main(String args[]) { UIManager.put("ProgressBar.repaintInterval", 100); UIManager.put("ProgressBar.border", BorderFactory.createLineBorder(Color.blue, 2)); JFrame f = new JFrame(); f.setLayout(new GridLayout(0, 1, 5, 5)); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(createBar());/*from w w w .jav a 2 s .c o m*/ f.add(createBar()); f.add(createBar()); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Justified Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border greenBorder = BorderFactory.createLineBorder(Color.GREEN, 2); Border blueBorder = BorderFactory.createLineBorder(Color.BLUE, 2); Border magentaBorder = BorderFactory.createLineBorder(Color.MAGENTA, 2); Border twoColorBorder = new CompoundBorder(magentaBorder, blueBorder); Border threeColorBorder = new CompoundBorder(twoColorBorder, greenBorder); JButton rainbowButton = new JButton("Rainbow"); rainbowButton.setBorder(threeColorBorder); Container contentPane = frame.getContentPane(); contentPane.add(rainbowButton);/*from ww w .j a va 2s. c om*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { SpringLayout layout = new SpringLayout(); JPanel p = new JPanel(layout); p.setBorder(BorderFactory.createLineBorder(Color.GREEN, 10)); JLabel l1 = new JLabel("label: width=90%", SwingConstants.CENTER); l1.setBorder(BorderFactory.createLineBorder(Color.RED, 1)); JButton l2 = new JButton("button: width=50%"); Spring panelw = layout.getConstraint(WIDTH, p); SpringLayout.Constraints c1 = layout.getConstraints(l1); c1.setX(Spring.constant(0));/*from w w w .ja v a2 s . c om*/ c1.setY(Spring.constant(20)); c1.setWidth(Spring.scale(panelw, 0.9f)); p.add(l1); SpringLayout.Constraints c2 = layout.getConstraints(l2); c2.setWidth(Spring.scale(panelw, 0.5f)); layout.putConstraint(SOUTH, l2, -20, SOUTH, p); layout.putConstraint(EAST, l2, -20, EAST, p); p.add(l2); JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(p); f.setSize(320, 240); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.pack();/*from w ww . ja v a2 s. c o m*/ Container contentPane = frame.getContentPane(); contentPane.setLayout(null); for (int i = 0; i < 4; i++) { JPanel panel = new JPanel(); panel.setBounds((i * 75) + 475, 25, 75, 100); System.out.println(panel.getBounds()); contentPane.add(panel); panel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3)); } System.out.println(getComponentAt(contentPane, new Point(475, 25))); System.out.println(getComponentAt(contentPane, new Point(100, 25))); frame.setVisible(true); }
From source file:ACompoundBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Compound Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border lineBorder = LineBorder.createBlackLineBorder(); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelLineBorder = new CompoundBorder(bevelBorder, lineBorder); JButton bevelLineButton = new JButton("Bevel Line"); bevelLineButton.setBorder(bevelLineBorder); Border redBorder = BorderFactory.createLineBorder(Color.MAGENTA, 2); Border orangeBorder = BorderFactory.createLineBorder(Color.BLUE, 2); Border yellowBorder = BorderFactory.createLineBorder(Color.YELLOW, 5); Border greenBorder = BorderFactory.createLineBorder(Color.GREEN, 2); Border blueBorder = BorderFactory.createLineBorder(Color.ORANGE, 4); Border magentaBorder = BorderFactory.createLineBorder(Color.RED, 3); Border twoColorBorder = new CompoundBorder(magentaBorder, blueBorder); Border threeColorBorder = new CompoundBorder(twoColorBorder, greenBorder); Border fourColorBorder = new CompoundBorder(threeColorBorder, yellowBorder); Border fiveColorBorder = new CompoundBorder(fourColorBorder, orangeBorder); Border sixColorBorder = new CompoundBorder(fiveColorBorder, redBorder); JButton rainbowButton = new JButton("Rainbow"); rainbowButton.setBorder(sixColorBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2)); contentPane.add(bevelLineButton);// w ww. j a va2 s . c om contentPane.add(rainbowButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:Main.java
static void createFrameAtLocation(Point p) { JFrame frame = new JFrame(); frame.setTitle("Test frame on two screens"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new BorderLayout()); JTextArea textareaA = new JTextArea(24, 80); textareaA.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1)); panel.add(textareaA, BorderLayout.CENTER); frame.setLocation(p);//from ww w. ja v a 2s . c om frame.add(panel); frame.pack(); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.setVisible(true); }
From source file:Main.java
public static Border getBorder(Color clr) { return BorderFactory.createLineBorder(clr, 1); }
From source file:Main.java
public static Border getBorderBlue(int thickness) { return BorderFactory.createLineBorder(Color.blue, thickness); }
From source file:Main.java
public static Border getBorderDefault(int thickness) { return BorderFactory.createLineBorder(Color.black, thickness); }
From source file:Main.java
public static Border getBorder(Color clr, int thickness) { return BorderFactory.createLineBorder(clr, thickness); }