Example usage for javax.swing BorderFactory createDashedBorder

List of usage examples for javax.swing BorderFactory createDashedBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createDashedBorder.

Prototype

public static Border createDashedBorder(Paint paint) 

Source Link

Document

Creates a dashed border of the specified paint .

Usage

From source file:Main.java

public Main() {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createDashedBorder(Color.red));

    add(labelTwo);//from w w  w .j  ava2  s  .  c om

    JLabel labelThree = new JLabel("MatteBorder");
    labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink));
    add(labelThree);

    JLabel labelFour = new JLabel("TitledBorder");
    labelFour.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink),
                    "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM));
    add(labelFour);

    JLabel labelSix = new JLabel("CompoundBorder");
    Border one = BorderFactory.createEtchedBorder();
    Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue);
    labelSix.setBorder(BorderFactory.createCompoundBorder(one, two));
    add(labelSix);

}

From source file:com.github.pemapmodder.pocketminegui.gui.server.ConsolePanel.java

public ConsolePanel(ServerMainActivity activity) {
    this.activity = activity;
    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createEmptyBorder(20, 10, 20, 10));
    title = new JLabel("PocketMine-MP");
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 0.1;//from   w w w .j a v  a 2  s  .c o  m
    add(title, c);
    stdout = new JEditorPane();
    stdout.setContentType("text/html");
    stdout.setText("<html><body style='font-family: monospace; color: #FFFFFF;'><p id='p'></p></body></html>");
    doc = (HTMLDocument) stdout.getDocument();
    para = doc.getElement("p");
    //      stdout.setEditable(false);
    // People NEED to see this to feel happy
    stdout.setForeground(Color.WHITE);
    stdout.setBackground(Color.BLACK);
    Style style = doc.getStyleSheet().addStyle(null, null);
    //      style.addAttribute(StyleConstants.Foreground, Color.WHITE);
    //      style.addAttribute(StyleConstants.Background, Color.RED);
    doc.setParagraphAttributes(para.getStartOffset(), 1, style, true);
    stdout.setBorder(BorderFactory.createDashedBorder(new Color(0x80, 0x80, 0x80)));
    c.gridy = 1;
    c.weightx = 0.9;
    c.weighty = 0.9;
    c.weighty = 0.6;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.NORTH;
    add(stdout, c);
    Timer timer = new Timer(50, e -> updateConsole());
    timer.start();
}