Border of all kinds : Border « Swing JFC « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Swing JFC » Border 




Border of all kinds
Border of all kinds
   
import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.MatteBorder;
import javax.swing.border.SoftBevelBorder;
import javax.swing.border.TitledBorder;

public class AnotherBorderTest extends JFrame {
  public AnotherBorderTest() {
    setTitle("Border Test");
    setSize(450450);

    JPanel content = (JPanelgetContentPane();
    content.setLayout(new GridLayout(62,3,3));

    JPanel p = new JPanel();
    p.setBorder(new BevelBorder(BevelBorder.RAISED));
    p.add(new JLabel("RAISED BevelBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new BevelBorder(BevelBorder.LOWERED));
    p.add(new JLabel("LOWERED BevelBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new LineBorder(Color.black, 5));
    p.add(new JLabel("Black LineBorder, thickness = 5"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new EmptyBorder(10101010));
    p.add(new JLabel("EmptyBorder with thickness of 10"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new EtchedBorder(EtchedBorder.RAISED));
    p.add(new JLabel("RAISED EtchedBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
    p.add(new JLabel("LOWERED EtchedBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED));
    p.add(new JLabel("RAISED SoftBevelBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
    p.add(new JLabel("LOWERED SoftBevelBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new MatteBorder(new ImageIcon("BALL.GIF")));
    p.add(new JLabel("MatteBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new TitledBorder(new MatteBorder(
        new ImageIcon("java2sLogo.gif"))"Title String"));
    p.add(new JLabel("TitledBorder using MatteBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new TitledBorder(new LineBorder(Color.black, 5),
        "Title String"));
    p.add(new JLabel("TitledBorder using LineBorder"));
    content.add(p);

    p = new JPanel();
    p.setBorder(new TitledBorder(new EmptyBorder(10101010),
        "Title String"));
    p.add(new JLabel("TitledBorder using EmptyBorder"));
    content.add(p);

    setVisible(true);
  }

  public static void main(String args[]) {
    new AnotherBorderTest();
  }
}
          
         
    
    
  














Related examples in the same category
1.Border Demo Border Demo
2.Different Swing bordersDifferent Swing borders
3.demonstrate the custom CurvedBorder classdemonstrate the custom CurvedBorder class
4.An example of the MatteBorder classAn example of the MatteBorder class
5.A simple demonstration of the LineBorder class built with rounded cornersA simple demonstration of the LineBorder class built with rounded corners
6.An example of using a titled border on a labelAn example of using a titled border on a label
7.Borders with a BevelBorder used on JLabels as a highlightBorders with a BevelBorder used on JLabels as a highlight
8.MatteBorder DemoMatteBorder Demo
9.TitledBorder DemoTitledBorder Demo
10.Custom Border SampleCustom Border Sample
11.How to create the borderHow to create the border
12.Solid border button border 3D borderSolid border button border 3D border
13.Oval borderOval border
14.EtchedBorderEtchedBorder
15.Red Green BorderRed Green Border
16.TitledBorderTitledBorder
17.TitledBorder 3TitledBorder 3
18.BevelBorder 2BevelBorder 2
19.Icon MatteBorderIcon MatteBorder
20.Soft BevelBorderSoft BevelBorder
21.Another TitledBorder 1Another TitledBorder 1
22.BevelBorderBevelBorder
23.EmptyBorderEmptyBorder
24.LineBorder DemoLineBorder Demo
25.CompoundBorder DemoCompoundBorder Demo
26.Adding a Title to a Border
27.Create a title border from another border
28.Change border text Justification alignment style
29.Bottom Border
30.Right border
31.Rectangle border
32.Set title position
33.Flex Border
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.