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) 

Source Link

Document

Adds a title to an existing border, with the specified positioning and font, and using the default text color (determined by the current look and feel).

Usage

From source file:Main.java

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

    add(labelTwo);//from   w  w  w. ja  v a2  s.  c  o  m

    JLabel labelFour = new JLabel("TitledBorder");
    labelFour.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink), "Title", TitledBorder.ABOVE_BOTTOM,
            TitledBorder.BOTTOM, new Font("font name", Font.BOLD, 19)));
    add(labelFour);

}

From source file:org.wsm.database.tools.editor.ui.GraphPane.java

public GraphPane() {
    GridBagLayout gbl = new GridBagLayout();
    this.setLayout(gbl);

    this.qesi = new QueryExecStatsInfo();
    this.qesi.addPropertyChangeListener(this);
    dcd = new DefaultCategoryDataset();
    JFreeChart chart = getChart(CHART_TYPE_BAR_3D);

    chart.setBackgroundPaint(Color.white);

    cp = new ChartPanel(chart);
    cp.setBorder(BorderFactory.createTitledBorder(null, "Graph", TitledBorder.LEADING, TitledBorder.TOP,
            UIConstants.LABEL_FONT));/* w ww  .  j a v  a2s .  co  m*/

    cp.setMouseZoomable(true, true);
    //cp.setPreferredSize(new Dimension(700, 500));
    gbl.setConstraints(cp, SwingUtils.getGridBagConstraints(0, 0, 2, 1));

    this.add(cp);
    JPanel graphTypeSelectionPanel = new JPanel();
    viewBarGraph = new JRadioButton("View Bar Graph", true);
    viewLineGraph = new JRadioButton("View Line Graph", false);
    viewLineGraph.setEnabled(false);
    ButtonGroup bg = new ButtonGroup();
    bg.add(viewBarGraph);
    bg.add(viewLineGraph);

    GridBagLayout graphTypeGBL = new GridBagLayout();
    graphTypeSelectionPanel.setLayout(graphTypeGBL);

    graphTypeGBL.setConstraints(viewBarGraph, SwingUtils.getGridBagConstraints(0, 0));
    graphTypeGBL.setConstraints(viewLineGraph, SwingUtils.getGridBagConstraints(1, 0));
    graphTypeSelectionPanel.add(viewBarGraph);
    graphTypeSelectionPanel.add(viewLineGraph);
    viewBarGraph.addActionListener(this);
    viewLineGraph.addActionListener(this);

    graphTypeSelectionPanel.setBorder(BorderFactory.createTitledBorder(null, "Graph Type", TitledBorder.LEADING,
            TitledBorder.TOP, UIConstants.LABEL_FONT));

    gbl.setConstraints(graphTypeSelectionPanel, SwingUtils.getGridBagConstraints(0, 1, 2, 1));

    this.add(graphTypeSelectionPanel);
    //this.setBounds(50, 100, 100, 200);
    this.setBackground(Color.WHITE);
}

From source file:com.mirth.connect.plugins.directoryresource.DirectoryResourcePropertiesPanel.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);
    setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Directory Settings",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    directoryLabel = new JLabel("Directory:");

    directoryField = new MirthTextField();
    directoryField.setToolTipText("The directory to load libraries from.");

    includeSubdirectoriesCheckBox = new MirthCheckBox("Include All Subdirectories");
    includeSubdirectoriesCheckBox.setBackground(getBackground());
    includeSubdirectoriesCheckBox.setToolTipText(
            "<html>Select Yes to traverse directories recursively and search for files in each one.</html>");

    descriptionLabel = new JLabel("Description:");

    descriptionTextPane = new MirthTextPane();
    descriptionScrollPane = new JScrollPane(descriptionTextPane);

    libraryLabel = new JLabel("Loaded Libraries:");

    libraryTable = new MirthTable();
    libraryTable.setModel(new RefreshTableModel(new Object[] { "Library" }, 0));
    libraryTable.setDragEnabled(false);/*from  ww  w  . j av a 2 s.c  o  m*/
    libraryTable.setRowSelectionAllowed(false);
    libraryTable.setRowHeight(UIConstants.ROW_HEIGHT);
    libraryTable.setFocusable(false);
    libraryTable.setOpaque(true);
    libraryTable.getTableHeader().setReorderingAllowed(false);
    libraryTable.setEditable(false);
    libraryTable.setSortable(false);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        libraryTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR));
    }

    libraryScrollPane = new JScrollPane(libraryTable);
}

From source file:com.mirth.connect.manager.HeapSizeDialog.java

private void initLayout() {
    setLayout(new MigLayout("insets 8, novisualpadding, hidemode 3, fill"));
    JPanel panel = new JPanel(new MigLayout("insets 4, novisualpadding, hidemode 3, fill"));
    panel.setBackground(Color.white);
    panel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(204, 204, 204)), "Web Start Settings",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    panel.add(new JLabel("Max Heap Size:"), "split");
    panel.add(heapSizeComboBox, "w 75!, left, wrap");

    panel.add(warningLabel, "split");

    add(panel);//  w w w . j a va 2 s  . c o  m
    add(new JSeparator(), "newline, growx, sx");
    add(okButton, "newline, h 22!, w 56!, sx, right, split");
    add(cancelButton, "h 22!, w 56!");
}

From source file:com.mirth.connect.client.ui.SettingsPanelDatabaseTasks.java

private void initComponents() {
    JPanel containerPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill"));
    containerPanel.setBackground(getBackground());
    containerPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Database Tasks",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));
    containerPanel.add(new JLabel(
            "Cleanup or optimization tasks for the internal database. If no tasks are present, no action is necessary."),
            "top, wrap");

    taskTable = new MirthTable();
    taskTable/*  w  w w  .j a  v  a2s  .c om*/
            .setModel(new RefreshTableModel(new Object[] { "Status", "Name", "Description", "Start Time" }, 0));
    taskTable.setDragEnabled(false);
    taskTable.setRowSelectionAllowed(true);
    taskTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    taskTable.setRowHeight(UIConstants.ROW_HEIGHT);
    taskTable.setFocusable(false);
    taskTable.setOpaque(true);
    taskTable.getTableHeader().setReorderingAllowed(false);
    taskTable.setEditable(false);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        taskTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR));
    }

    taskTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            checkSelection(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            checkSelection(evt);
        }

        private void checkSelection(MouseEvent evt) {
            if (taskTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) {
                taskTable.clearSelection();
                setVisibleTasks(2, 3, false);
            }
        }
    });

    taskTable.getColumnModel().getColumn(0).setMinWidth(75);
    taskTable.getColumnModel().getColumn(0).setMaxWidth(75);
    taskTable.getColumnModel().getColumn(0).setCellRenderer(new ImageCellRenderer());

    taskTable.getColumnModel().getColumn(1).setMinWidth(45);
    taskTable.getColumnModel().getColumn(1).setPreferredWidth(250);

    taskTable.getColumnModel().getColumn(2).setMinWidth(75);
    taskTable.getColumnModel().getColumn(2).setPreferredWidth(475);

    taskTable.getColumnModel().getColumn(3).setMinWidth(95);
    taskTable.getColumnModel().getColumn(3).setMaxWidth(95);
    taskTable.getColumnModel().getColumn(3).setCellRenderer(new DateCellRenderer());

    taskTable.getSelectionModel().addListSelectionListener(this);

    JScrollPane taskTableScrollPane = new JScrollPane(taskTable);
    containerPanel.add(taskTableScrollPane, "grow, push");

    add(containerPanel, "grow, h 60%");

    JPanel channelsPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill"));
    channelsPanel.setBackground(getBackground());
    channelsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Affected Channels",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    channelsTable = new MirthTable();
    channelsTable.setModel(new RefreshTableModel(new Object[] { "Name", "Id" }, 0));
    channelsTable.setDragEnabled(false);
    channelsTable.setRowSelectionAllowed(false);
    channelsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    channelsTable.setFocusable(false);
    channelsTable.setOpaque(true);
    channelsTable.getTableHeader().setReorderingAllowed(false);
    channelsTable.setEditable(false);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        channelsTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR));
    }

    channelsPanel.add(new JScrollPane(channelsTable), "grow");

    add(channelsPanel, "newline, grow, h 40%");
}

From source file:com.mirth.connect.client.ui.panels.connectors.DestinationSettingsPanel.java

private void initComponents() {
    setLayout(new MigLayout("insets 4 8 4 4, novisualpadding, hidemode 3, fill", "[]13[grow]"));
    setBackground(UIConstants.BACKGROUND_COLOR);
    setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Destination Settings",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    queueMessagesLabel = new JLabel("Queue Messages:");

    ButtonGroup queueMessagesButtonGroup = new ButtonGroup();
    ActionListener queueMessagesActionListener = new ActionListener() {
        @Override/*from  w  w w.ja v  a  2 s .c  om*/
        public void actionPerformed(ActionEvent evt) {
            updateQueueMessages();
        }
    };

    queueMessagesNeverRadio = new MirthRadioButton("Never");
    queueMessagesNeverRadio.setBackground(getBackground());
    queueMessagesNeverRadio.setToolTipText("Disable the destination queue.");
    queueMessagesNeverRadio.addActionListener(queueMessagesActionListener);
    queueMessagesButtonGroup.add(queueMessagesNeverRadio);

    queueMessagesOnFailureRadio = new MirthRadioButton("On Failure");
    queueMessagesOnFailureRadio.setBackground(getBackground());
    queueMessagesOnFailureRadio.setToolTipText(
            "<html>Attempt to send the message first before queueing it. This will allow subsequent<br/>destinations and the Postprocessor to use the response from this destination if it<br/>successfully sends before queueing.</html>");
    queueMessagesOnFailureRadio.addActionListener(queueMessagesActionListener);
    queueMessagesButtonGroup.add(queueMessagesOnFailureRadio);

    queueMessagesAlwaysRadio = new MirthRadioButton("Always");
    queueMessagesAlwaysRadio.setBackground(getBackground());
    queueMessagesAlwaysRadio.setToolTipText(
            "<html>Immediately queue the message. Subsequent destinations and the<br/>Postprocessor will always see this destination's response as QUEUED.</html>");
    queueMessagesAlwaysRadio.addActionListener(queueMessagesActionListener);
    queueMessagesButtonGroup.add(queueMessagesAlwaysRadio);

    queueMessagesWarningLabel = new JLabel();
    queueMessagesWarningLabel.setForeground(Color.RED);

    advancedQueueSettingsLabel = new JLabel("Advanced Queue Settings:");

    advancedQueueSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png")));
    advancedQueueSettingsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            new AdvancedDialog();
        }
    });

    advancedQueueSettingsValueLabel = new JLabel();

    validateResponseLabel = new JLabel("Validate Response:");

    ButtonGroup validateResponseButtonGroup = new ButtonGroup();
    String toolTipText = "<html>Select Yes to validate the response. Responses can only be validated if the<br>response transformer's inbound properties contains a <b>Response Validation</b><br>section. If validation fails, the message will be marked as queued or errored.</html>";

    validateResponseYesRadio = new MirthRadioButton("Yes");
    validateResponseYesRadio.setBackground(getBackground());
    validateResponseYesRadio.setToolTipText(toolTipText);
    validateResponseButtonGroup.add(validateResponseYesRadio);

    validateResponseNoRadio = new MirthRadioButton("No");
    validateResponseNoRadio.setBackground(getBackground());
    validateResponseNoRadio.setToolTipText(toolTipText);
    validateResponseButtonGroup.add(validateResponseNoRadio);
}

From source file:com.mirth.connect.client.ui.components.rsta.FindReplaceDialog.java

private void initComponents() {
    setLayout(new MigLayout("insets 11, novisualpadding, hidemode 3, fill, gap 6"));
    setBackground(UIConstants.COMBO_BOX_BACKGROUND);
    getContentPane().setBackground(getBackground());

    findPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill, gap 6"));
    findPanel.setBackground(getBackground());

    ActionListener findActionListener = new ActionListener() {
        @Override/*from   w  w w  .jav  a  2  s .c o  m*/
        public void actionPerformed(ActionEvent evt) {
            find();
        }
    };

    findLabel = new JLabel("Find text:");
    findComboBox = new JComboBox<String>();
    findComboBox.setEditable(true);
    findComboBox.setBackground(UIConstants.BACKGROUND_COLOR);

    findComboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(final KeyEvent evt) {
            if (evt.getKeyCode() == KeyEvent.VK_ENTER && evt.getModifiers() == 0) {
                find();
            }
        }
    });

    ActionListener replaceActionListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            replace();
        }
    };

    replaceLabel = new JLabel("Replace with:");
    replaceComboBox = new JComboBox<String>();
    replaceComboBox.setEditable(true);
    replaceComboBox.setBackground(UIConstants.BACKGROUND_COLOR);

    directionPanel = new JPanel(new MigLayout("insets 8, novisualpadding, hidemode 3, fill, gap 6"));
    directionPanel.setBackground(getBackground());
    directionPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(new Color(150, 150, 150)), "Direction",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    ButtonGroup directionButtonGroup = new ButtonGroup();

    directionForwardRadio = new JRadioButton("Forward");
    directionForwardRadio.setBackground(directionPanel.getBackground());
    directionButtonGroup.add(directionForwardRadio);

    directionBackwardRadio = new JRadioButton("Backward");
    directionBackwardRadio.setBackground(directionPanel.getBackground());
    directionButtonGroup.add(directionBackwardRadio);

    optionsPanel = new JPanel(new MigLayout("insets 8, novisualpadding, hidemode 3, fill, gap 6"));
    optionsPanel.setBackground(getBackground());
    optionsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(new Color(150, 150, 150)), "Options",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    wrapSearchCheckBox = new JCheckBox("Wrap Search");
    matchCaseCheckBox = new JCheckBox("Match Case");
    regularExpressionCheckBox = new JCheckBox("Regular Expression");
    wholeWordCheckBox = new JCheckBox("Whole Word");

    findButton = new JButton("Find");
    findButton.addActionListener(findActionListener);

    replaceButton = new JButton("Replace");
    replaceButton.addActionListener(replaceActionListener);

    replaceAllButton = new JButton("Replace All");
    replaceAllButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            replaceAll();
        }
    });

    warningLabel = new JLabel();

    closeButton = new JButton("Close");
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            dispose();
        }
    });
}

From source file:com.mirth.connect.client.ui.panels.connectors.SourceSettingsPanel.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);
    setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Source Settings",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    sourceQueueLabel = new JLabel("Source Queue:");

    sourceQueueComboBox = new MirthComboBox();
    sourceQueueComboBox.setModel(new DefaultComboBoxModel(
            new String[] { "OFF (Respond after processing)", "ON (Respond before processing)" }));
    sourceQueueComboBox.setToolTipText(/*from   w ww.  ja va 2  s .  c  o  m*/
            "<html>Selecting OFF will process the message before sending the response (can use response from destinations)<br>Selecting ON will queue messages and immediately send a response (cannot use response from destinations)</html>");
    sourceQueueComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            sourceQueueComboBoxActionPerformed(evt);
        }
    });

    queueWarningLabel = new JLabel("Queuing is not supported by the current message storage mode.");
    queueWarningLabel.setForeground(Color.RED);

    queueBufferSizeLabel = new JLabel("Queue Buffer Size:");
    queueBufferSizeField = new JTextField();
    queueBufferSizeField.setDocument(new MirthFieldConstraints(0, false, false, true));
    queueBufferSizeField.setToolTipText(
            "<html>The buffer size for the source queue.<br/>Up to this many connector messages may<br/>be held in memory at once when queuing.</html>");

    responseLabel = new JLabel("Response:");

    responseComboBox = new MirthComboBox();
    responseComboBox
            .setModel(new DefaultComboBoxModel(new String[] { "Auto-generate (After source transformer)",
                    "None", "Auto-generate (Before processing)", "Auto-generate (After source transformer)",
                    "Auto-generate (Destinations completed)", "Post-processor", "Destination 1" }));
    responseComboBox.setToolTipText(
            "<html>Select a destination's response, the postprocessor return value, or a response map variable.<br/>Select <b>\"Auto-generate\"</b> to send a response generated by the inbound data type using the raw message:<br/>&nbsp;- <b>Before processing:</b> Response generated before the channel processes the message (SENT status)<br/>&nbsp;- <b>After source transformer:</b> Response generated after the channel processes the message (source status)<br/>&nbsp;- <b>Destinations completed:</b> Response generated after the channel processes the message, with a status<br/>&nbsp;&nbsp;&nbsp;&nbsp;based on the destination statuses, using a precedence of ERROR, QUEUED, SENT, FILTERED<br/></html>");

    processBatchLabel = new JLabel("Process Batch:");
    ButtonGroup processBatchButtonGroup = new ButtonGroup();

    processBatchYesRadio = new MirthRadioButton("Yes");
    processBatchYesRadio.setBackground(getBackground());
    processBatchYesRadio.setToolTipText(
            "<html>Select Yes to enable batch processing. Batch messages are only supported if<br>the source connector's inbound properties contains a <b>Batch</b> section.</html>");
    processBatchYesRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            processBatchYesRadioActionPerformed(evt);
        }
    });
    processBatchButtonGroup.add(processBatchYesRadio);

    processBatchNoRadio = new MirthRadioButton("No");
    processBatchNoRadio.setBackground(getBackground());
    processBatchNoRadio.setToolTipText(
            "<html>Select Yes to enable batch processing. Batch messages are only supported if<br>the source connector's inbound properties contains a <b>Batch</b> section.</html>");
    processBatchNoRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            processBatchNoRadioActionPerformed(evt);
        }
    });
    processBatchButtonGroup.add(processBatchNoRadio);

    batchResponseLabel = new JLabel("Batch Response:");
    ButtonGroup batchResponseButtonGroup = new ButtonGroup();

    batchResponseFirstRadio = new MirthRadioButton("First");
    batchResponseFirstRadio.setBackground(getBackground());
    batchResponseFirstRadio.setToolTipText(
            "<html>Each message in the batch contains its own response that is generated via the method selected above.<br> Select either the response from the first or last message in the batch to be sent back to the originating system.</html>");
    batchResponseButtonGroup.add(batchResponseFirstRadio);

    batchResponseLastRadio = new MirthRadioButton("Last");
    batchResponseLastRadio.setBackground(getBackground());
    batchResponseLastRadio.setToolTipText(
            "<html>Each message in the batch contains its own response that is generated via the method selected above.<br> Select either the response from the first or last message in the batch to be sent back to the originating system.</html>");
    batchResponseButtonGroup.add(batchResponseLastRadio);

    processingThreadsLabel = new JLabel("Max Processing Threads:");

    processingThreadsField = new MirthTextField();
    processingThreadsField.setDocument(new MirthFieldConstraints(0, false, false, true));
    processingThreadsField.setToolTipText(
            "<html>The maximum number of messages that can process through<br/>the channel simultaneously. Note that when this value<br/>is greater than 1, message order is NOT guaranteed.</html>");
}

From source file:com.mirth.connect.client.ui.SettingsPanelAdministrator.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);

    systemSettingsPanel = new JPanel();
    systemSettingsPanel.setBackground(getBackground());
    systemSettingsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "System Preferences",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    dashboardRefreshIntervalLabel = new JLabel("Dashboard refresh interval (seconds):");
    dashboardRefreshIntervalField = new MirthTextField();
    dashboardRefreshIntervalField.setToolTipText(
            "<html>Interval in seconds at which to refresh the Dashboard. Decrement this for <br>faster updates, and increment it for slower servers with more channels.</html>");

    String toolTipText = "Sets the default page size for browsers (message, event, etc.)";
    messageBrowserPageSizeLabel = new JLabel("Message browser page size:");
    messageBrowserPageSizeField = new MirthTextField();
    messageBrowserPageSizeField.setToolTipText(toolTipText);

    eventBrowserPageSizeLabel = new JLabel("Event browser page size:");
    eventBrowserPageSizeField = new MirthTextField();
    eventBrowserPageSizeField.setToolTipText(toolTipText);

    formatLabel = new JLabel("Format text in message browser:");
    formatButtonGroup = new ButtonGroup();

    toolTipText = "Pretty print messages in the message browser.";
    formatYesRadio = new MirthRadioButton("Yes");
    formatYesRadio.setBackground(systemSettingsPanel.getBackground());
    formatYesRadio.setToolTipText(toolTipText);
    formatButtonGroup.add(formatYesRadio);

    formatNoRadio = new MirthRadioButton("No");
    formatNoRadio.setBackground(systemSettingsPanel.getBackground());
    formatNoRadio.setToolTipText(toolTipText);
    formatButtonGroup.add(formatNoRadio);

    textSearchWarningLabel = new JLabel("Message browser text search confirmation:");
    textSearchWarningButtonGroup = new ButtonGroup();

    toolTipText = "<html>Show a confirmation dialog in the message browser when attempting a text search, warning users<br/>that the query may take a long time depending on the amount of messages being searched.</html>";
    textSearchWarningYesRadio = new MirthRadioButton("Yes");
    textSearchWarningYesRadio.setBackground(systemSettingsPanel.getBackground());
    textSearchWarningYesRadio.setToolTipText(toolTipText);
    textSearchWarningButtonGroup.add(textSearchWarningYesRadio);

    textSearchWarningNoRadio = new MirthRadioButton("No");
    textSearchWarningNoRadio.setBackground(systemSettingsPanel.getBackground());
    textSearchWarningNoRadio.setToolTipText(toolTipText);
    textSearchWarningButtonGroup.add(textSearchWarningNoRadio);

    importChannelLibrariesLabel = new JLabel("Import code template libraries with channels:");
    importChannelLibrariesButtonGroup = new ButtonGroup();

    toolTipText = "<html>When attempting to import channels that have code template<br/>libraries linked to them, select Yes to always include them,<br/>No to never include them, or Ask to prompt the user each time.</html>";
    importChannelLibrariesYesRadio = new MirthRadioButton("Yes");
    importChannelLibrariesYesRadio.setBackground(systemSettingsPanel.getBackground());
    importChannelLibrariesYesRadio.setToolTipText(toolTipText);
    importChannelLibrariesButtonGroup.add(importChannelLibrariesYesRadio);

    importChannelLibrariesNoRadio = new MirthRadioButton("No");
    importChannelLibrariesNoRadio.setBackground(systemSettingsPanel.getBackground());
    importChannelLibrariesNoRadio.setToolTipText(toolTipText);
    importChannelLibrariesButtonGroup.add(importChannelLibrariesNoRadio);

    importChannelLibrariesAskRadio = new MirthRadioButton("Ask");
    importChannelLibrariesAskRadio.setBackground(systemSettingsPanel.getBackground());
    importChannelLibrariesAskRadio.setToolTipText(toolTipText);
    importChannelLibrariesButtonGroup.add(importChannelLibrariesAskRadio);

    exportChannelLibrariesLabel = new JLabel("Export code template libraries with channels:");
    exportChannelLibrariesButtonGroup = new ButtonGroup();

    toolTipText = "<html>When attempting to export channels that have code template<br/>libraries linked to them, select Yes to always include them,<br/>No to never include them, or Ask to prompt the user each time.</html>";
    exportChannelLibrariesYesRadio = new MirthRadioButton("Yes");
    exportChannelLibrariesYesRadio.setBackground(systemSettingsPanel.getBackground());
    exportChannelLibrariesYesRadio.setToolTipText(toolTipText);
    exportChannelLibrariesButtonGroup.add(exportChannelLibrariesYesRadio);

    exportChannelLibrariesNoRadio = new MirthRadioButton("No");
    exportChannelLibrariesNoRadio.setBackground(systemSettingsPanel.getBackground());
    exportChannelLibrariesNoRadio.setToolTipText(toolTipText);
    exportChannelLibrariesButtonGroup.add(exportChannelLibrariesNoRadio);

    exportChannelLibrariesAskRadio = new MirthRadioButton("Ask");
    exportChannelLibrariesAskRadio.setBackground(systemSettingsPanel.getBackground());
    exportChannelLibrariesAskRadio.setToolTipText(toolTipText);
    exportChannelLibrariesButtonGroup.add(exportChannelLibrariesAskRadio);

    userSettingsPanel = new JPanel();
    userSettingsPanel.setBackground(getBackground());
    userSettingsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "User Preferences",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    checkForNotificationsLabel = new JLabel("Check for new notifications on login:");
    notificationButtonGroup = new ButtonGroup();

    checkForNotificationsYesRadio = new MirthRadioButton("Yes");
    checkForNotificationsYesRadio.setBackground(userSettingsPanel.getBackground());
    checkForNotificationsYesRadio.setToolTipText(
            "<html>Checks for notifications from Mirth (announcements, available updates, etc.)<br/>relevant to this version of Mirth Connect whenever user logs in.</html>");
    notificationButtonGroup.add(checkForNotificationsYesRadio);

    checkForNotificationsNoRadio = new MirthRadioButton("No");
    checkForNotificationsNoRadio.setBackground(userSettingsPanel.getBackground());
    checkForNotificationsNoRadio.setToolTipText(
            "<html>Checks for notifications from Mirth (announcements, available updates, etc.)<br/>relevant to this version of Mirth Connect whenever user logs in.</html>");
    notificationButtonGroup.add(checkForNotificationsNoRadio);

    codeEditorSettingsPanel = new JPanel();
    codeEditorSettingsPanel.setBackground(getBackground());
    codeEditorSettingsPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Code Editor Preferences",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    toolTipText = "<html>The auto-completion popup will be triggered<br/>after any of these characters are typed.</html>";
    autoCompleteCharactersLabel = new JLabel("Auto-Complete Characters:");
    autoCompleteCharactersField = new MirthTextField();
    autoCompleteCharactersField.setToolTipText(toolTipText);
    autoCompleteCharactersField.getDocument().addDocumentListener(new DocumentListener() {
        @Override//w w  w.ja  va 2  s. c o m
        public void insertUpdate(DocumentEvent evt) {
            autoCompleteActionPerformed();
        }

        @Override
        public void removeUpdate(DocumentEvent evt) {
            autoCompleteActionPerformed();
        }

        @Override
        public void changedUpdate(DocumentEvent evt) {
            autoCompleteActionPerformed();
        }
    });

    toolTipText = "<html>If selected, auto-completion will be<br/>triggered after any letter is typed.</html>";
    autoCompleteIncludeLettersCheckBox = new MirthCheckBox("Include Letters");
    autoCompleteIncludeLettersCheckBox.setBackground(codeEditorSettingsPanel.getBackground());
    autoCompleteIncludeLettersCheckBox.setToolTipText(toolTipText);
    autoCompleteIncludeLettersCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            autoCompleteActionPerformed();
        }
    });

    toolTipText = "<html>The amount of time to wait after typing<br/>an activation character before opening<br/>the auto-completion popup menu.</html>";
    autoCompleteDelayLabel = new JLabel("Activation Delay (ms):");
    autoCompleteDelayField = new MirthTextField();
    autoCompleteDelayField.setToolTipText(toolTipText);
    autoCompleteDelayField.setDocument(new MirthFieldConstraints(9, false, false, true));

    shortcutKeyLabel = new JLabel("Shortcut Key Mappings:");

    shortcutKeyTable = new MirthTable();
    shortcutKeyTable.setModel(new RefreshTableModel(
            new Object[] { "Action Info", "Name", "Description", "Shortcut Key Mapping" }, 0) {
        @Override
        public boolean isCellEditable(int row, int column) {
            return column == KEY_COLUMN;
        }
    });

    shortcutKeyTable.setDragEnabled(false);
    shortcutKeyTable.setRowSelectionAllowed(false);
    shortcutKeyTable.setRowHeight(UIConstants.ROW_HEIGHT);
    shortcutKeyTable.setFocusable(false);
    shortcutKeyTable.setOpaque(true);
    shortcutKeyTable.setSortable(true);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        shortcutKeyTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    shortcutKeyTable.getColumnModel().getColumn(NAME_COLUMN).setMinWidth(145);
    shortcutKeyTable.getColumnModel().getColumn(NAME_COLUMN).setPreferredWidth(145);

    shortcutKeyTable.getColumnModel().getColumn(DESCRIPTION_COLUMN).setPreferredWidth(600);

    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setMinWidth(120);
    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setPreferredWidth(150);
    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setCellRenderer(new KeyStrokeCellRenderer());
    shortcutKeyTable.getColumnModel().getColumn(KEY_COLUMN).setCellEditor(new KeyStrokeCellEditor());

    shortcutKeyTable.removeColumn(shortcutKeyTable.getColumnModel().getColumn(ACTION_INFO_COLUMN));

    shortcutKeyTable.getModel().addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent evt) {
            updateRestoreDefaultsButton();
        }
    });

    shortcutKeyScrollPane = new JScrollPane(shortcutKeyTable);

    restoreDefaultsButton = new JButton("Restore Defaults");
    restoreDefaultsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            restoreDefaults();
        }
    });
}

From source file:com.mirth.connect.connectors.file.AdvancedSftpSettingsDialog.java

private void initLayout() {
    JPanel propertiesPanel = new JPanel(
            new MigLayout("insets 12, novisualpadding, hidemode 3, fillx", "[right][left]"));
    propertiesPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    propertiesPanel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(204, 204, 204)), "SFTP Settings",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11)));

    propertiesPanel.add(authenticationLabel);
    propertiesPanel.add(usePasswordRadio, "split 3");
    propertiesPanel.add(usePrivateKeyRadio);
    propertiesPanel.add(useBothRadio, "push, wrap");

    propertiesPanel.add(keyLocationLabel);
    propertiesPanel.add(keyLocationField, "w 200!, wrap");

    propertiesPanel.add(passphraseLabel);
    propertiesPanel.add(passphraseField, "w 125!, wrap");

    propertiesPanel.add(useKnownHostsLabel);
    propertiesPanel.add(useKnownHostsYesRadio, "split 3");
    propertiesPanel.add(useKnownHostsAskRadio);
    propertiesPanel.add(useKnownHostsNoRadio, "push, wrap");

    propertiesPanel.add(knownHostsLocationLabel);
    propertiesPanel.add(knownHostsField, "w 200!, wrap");

    propertiesPanel.add(configurationsLabel, "aligny top");
    propertiesPanel.add(configurationsScrollPane, "span, grow, split 2");

    JPanel configurationsButtonPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill"));
    configurationsButtonPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    configurationsButtonPanel.add(newButton, "w 50!, wrap");
    configurationsButtonPanel.add(deleteButton, "w 50!");

    propertiesPanel.add(configurationsButtonPanel, "top");

    add(propertiesPanel, "grow, push, top, wrap");

    JPanel buttonPanel = new JPanel(new MigLayout("insets 0 8 8 8, novisualpadding, hidemode 3, fill"));
    buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    buttonPanel.add(new JSeparator(), "growx, sx, wrap");
    buttonPanel.add(okButton, "newline, w 50!, sx, right, split");
    buttonPanel.add(cancelButton, "w 50!");

    add(buttonPanel, "south, span");
}