Example usage for javax.swing BorderFactory createTitledBorder

List of usage examples for javax.swing BorderFactory createTitledBorder

Introduction

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

Prototype

public static TitledBorder createTitledBorder(Border border, String title, int titleJustification,
        int titlePosition, Font titleFont, Color titleColor) 

Source Link

Document

Adds a title to an existing border, with the specified positioning, font and color.

Usage

From source file:SuitaDetails.java

public PropPanel() {
    jPanel1 = new JPanel();
    addpanel = new JPanel();
    addpanel.setMaximumSize(new Dimension(32767, 25));
    addpanel.setMinimumSize(new Dimension(0, 25));
    addpanel.setPreferredSize(new Dimension(50, 25));
    addpanel.setLayout(new BorderLayout());
    JButton add = new JButton("Add");
    add.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone();
            indexpos3.add(new Integer(parent.getSubItemsNr()));
            Item property = new Item("", 0, -1, -1, 10, 20, indexpos3);
            property.setSubItemVisible(false);
            property.setValue("");
            parent.addSubItem(property);
            Prop prop = new Prop(parent, property);
            jPanel1.remove(addpanel);/*  w w w . j a v  a 2  s .  c o  m*/
            jPanel1.add(prop);
            jPanel1.add(addpanel);
            jPanel1.revalidate();
            jPanel1.repaint();
        }
    });
    addpanel.add(add, BorderLayout.EAST);
    addpanel.setBackground(Color.WHITE);
    JScrollPane jScrollPane1 = new JScrollPane(jPanel1);
    jPanel1.setBackground(Color.WHITE);
    jScrollPane1.setBackground(Color.WHITE);
    jScrollPane1.setBorder(null);
    jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)),
            "Properties", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null,
            new Color(0, 0, 0)));
    setBackground(Color.WHITE);
    GroupLayout propLayout = new GroupLayout(this);
    setLayout(propLayout);
    propLayout.setHorizontalGroup(
            propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1));
    propLayout.setVerticalGroup(
            propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1));
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Startup the SPARQL server//  w  w  w .ja va  2s. c  o  m
 */
private void startSparqlServer() {
    if (!SparqlServer.getInstance().isActive()) {
        if (ontModel != null) {
            publishModelToTheSparqlServer();
            SparqlServer.getInstance().addObserver(this);

            try {
                SparqlServer.getInstance().start();
            } catch (Throwable throwable) {
                LOGGER.error("Unable to start the SPARQL server", throwable);
                SparqlServer.getInstance().deleteObserver(this);
                JOptionPane.showMessageDialog(this,
                        "Unable to start the SPARQL server\n" + throwable.getMessage(),
                        "Cannot Start the SPARQL Server", JOptionPane.ERROR_MESSAGE);
            }

            if (SparqlServer.getInstance().isActive()) {
                if (SparqlServer.getInstance().areRemoteUpdatesPermitted()) {
                    sparqlServerInfo.setBorder(
                            BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.red.darker()),
                                    "SPARQL Server Status (Updates Allowed)",
                                    TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                                    BorderFactory.createTitledBorder("").getTitleFont(), Color.red.darker()));

                }
                sparqlServerInfo.setForeground(Color.blue.darker());
                updateSparqlServerInfo();
                setStatus("SPARQL server started on port " + SparqlServer.getInstance().getListenerPort()
                        + (SparqlServer.getInstance().areRemoteUpdatesPermitted() ? " (Remote Updates Enabled)"
                                : ""));
            }
        } else {
            JOptionPane.showMessageDialog(this, "You must create a model before starting the SPARQL server",
                    "Cannot Start SPARQL Server", JOptionPane.WARNING_MESSAGE);
        }
    } else {
        setStatus("SPARQL server is already running");
    }

    enableControls(true);
}