List of usage examples for javax.swing JButton setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:Main.java
License:asdf
public static void main(String[] argv) { LineBorder border1 = new LineBorder(Color.red); TitledBorder border2 = new TitledBorder("asdf"); Border newBorder = BorderFactory.createCompoundBorder(border1, border2); JButton component = new JButton("button"); component.setBorder(newBorder); }
From source file:ABevelBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Bevel Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = BorderFactory.createRaisedBevelBorder(); JButton button = new JButton("Raised"); button.setBorder(raisedBorder); frame.add(button);// ww w . j a v a2s . c om frame.setSize(300, 100); frame.setVisible(true); }
From source file:ABevelBorderLoweredBevelBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Bevel Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border loweredBorder = BorderFactory.createLoweredBevelBorder(); JButton button = new JButton("Raised"); button.setBorder(loweredBorder); frame.add(button);/*from w w w . j ava 2s . c o m*/ frame.setSize(300, 100); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Positioned Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TitledBorder aboveTopBorder = BorderFactory.createTitledBorder("AboveTop"); aboveTopBorder.setTitlePosition(TitledBorder.ABOVE_TOP); JButton aboveTopButton = new JButton(); aboveTopButton.setBorder(aboveTopBorder); Container contentPane = frame.getContentPane(); contentPane.add(aboveTopButton);//from w w w. ja v a2s . co m frame.setSize(300, 200); frame.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); TitledBorder leftBorder = BorderFactory.createTitledBorder("Left"); leftBorder.setTitleJustification(TitledBorder.LEFT); JButton leftButton = new JButton(); leftButton.setBorder(leftBorder); Container contentPane = frame.getContentPane(); contentPane.add(leftButton);/* w w w . j a v a2s . c o m*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:DoubleTitle.java
public static void main(String args[]) { JFrame frame = new JFrame("Double Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TitledBorder topBorder = BorderFactory.createTitledBorder("Top"); topBorder.setTitlePosition(TitledBorder.TOP); TitledBorder doubleBorder = new TitledBorder(topBorder, "Bottom", TitledBorder.RIGHT, TitledBorder.BOTTOM); JButton doubleButton = new JButton(); doubleButton.setBorder(doubleBorder); Container contentPane = frame.getContentPane(); contentPane.add(doubleButton, BorderLayout.CENTER); frame.setSize(300, 100);// ww w . ja va2 s . c o m frame.setVisible(true); }
From source file:ABevelBorderLoweredBevelBorderRAISED.java
public static void main(String args[]) { JFrame frame = new JFrame("Bevel Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED); // Border myLoweredBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.PINK, // Color.RED); JButton button = new JButton("Raised"); button.setBorder(myRaisedBorder); frame.add(button);/*from ww w . jav a2s .c o m*/ frame.setSize(300, 100); frame.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); TitledBorder centerBorder = BorderFactory.createTitledBorder("Center"); centerBorder.setTitleJustification(TitledBorder.CENTER); JButton centerButton = new JButton(); centerButton.setBorder(centerBorder); Container contentPane = frame.getContentPane(); contentPane.add(centerButton);//from www.j av a 2 s. co m frame.setSize(300, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Positioned Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TitledBorder belowTopBorder = BorderFactory.createTitledBorder("BelowTop"); belowTopBorder.setTitlePosition(TitledBorder.BELOW_TOP); JButton belowTopButton = new JButton(); belowTopButton.setBorder(belowTopBorder); Container contentPane = frame.getContentPane(); contentPane.add(belowTopButton);/*from ww w . ja v a 2 s . c o m*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Positioned Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TitledBorder belowBottomBorder = BorderFactory.createTitledBorder("BelowBottom"); belowBottomBorder.setTitlePosition(TitledBorder.BELOW_BOTTOM); JButton belowBottomButton = new JButton(); belowBottomButton.setBorder(belowBottomBorder); Container contentPane = frame.getContentPane(); contentPane.add(belowBottomButton);/*from ww w . ja va 2 s.c o m*/ frame.setSize(300, 200); frame.setVisible(true); }