Example usage for javax.swing SwingConstants LEFT

List of usage examples for javax.swing SwingConstants LEFT

Introduction

In this page you can find the example usage for javax.swing SwingConstants LEFT.

Prototype

int LEFT

To view the source code for javax.swing SwingConstants LEFT.

Click Source Link

Document

Box-orientation constant used to specify the left side of a box.

Usage

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.resultexplanationpanel.QueryStatisticsCollectionPanel.java

/**
 * Inits the components./*from  www.  ja  va 2s.c o  m*/
 */
public synchronized void initComponents() {

    resultCountLabel = new JXLabel(
            "<html><b>Number of patients satisfying criteria in the query : </b></html>");
    resultCountLabel.setHorizontalTextPosition(SwingConstants.LEFT);
    queryTimeLabel = new JXLabel("<html><b>Time taken to return results for query : </b></html>");
    queryTimeLabel.setHorizontalTextPosition(SwingConstants.LEFT);

    // create panels and add labels
    JPanel countPanel = new JPanel();
    countPanel.setLayout(new BoxLayout(countPanel, BoxLayout.LINE_AXIS));
    countPanel.add(resultCountLabel);
    countPanel.add(Box.createHorizontalGlue());
    JPanel timePanel = new JPanel();
    timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.LINE_AXIS));
    timePanel.add(Box.createHorizontalGlue());
    timePanel.add(queryTimeLabel);
    JPanel labelsPanel = new JPanel();
    labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.PAGE_AXIS));
    labelsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    labelsPanel.add(countPanel);
    labelsPanel.add(timePanel);
    // add empty panel for spacing
    labelsPanel.add(new JXLabel(" "));

    JPanel humanReadableLabelPanel = new JPanel(new BorderLayout());
    humanReadableLabelPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(),
            BorderFactory.createTitledBorder("Query Text")));
    humanReadableLabel = new JXLabel();
    humanReadableLabel.setLineWrap(true);
    humanReadableLabelPanel.add(humanReadableLabel, BorderLayout.CENTER);

    JPanel upperPanel = new JPanel(new BorderLayout());
    upperPanel.add(humanReadableLabelPanel, BorderLayout.CENTER);
    upperPanel.add(labelsPanel, BorderLayout.SOUTH);

    commentedStepsTextArea = new JTextArea();
    commentedStepsTextArea.setLineWrap(true);
    commentedStepsTextArea.setEditable(false);
    commentedStepsTextArea.setWrapStyleWord(true);
    // create panel for comments text area
    JPanel commentsPanel = createStatementsPanel(commentedStepsTextArea, "SQL Steps");

    sqlStatementsTextArea = new JTextArea();
    sqlStatementsTextArea.setLineWrap(true);
    sqlStatementsTextArea.setEditable(false);
    sqlStatementsTextArea.setWrapStyleWord(true);
    // create panel for sql statements
    JPanel sqlPanel = createStatementsPanel(sqlStatementsTextArea, "SQL Statements");

    // create a tabbed pane to contain the statements panels
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.addTab("Steps", null, commentsPanel, "Commented steps executed in generating the result");
    tabbedPane.addTab("SQL", null, sqlPanel, "SQL Statements used in generating the result");

    // add components to this panel
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder());
    setPreferredSize(new Dimension(550, 450));
    add(upperPanel, BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.app.impl.ModularDockingApplicationView.java

/**
 * Inits the components./*w  w w. ja  va 2  s.c o m*/
 * @param view the ModularDockingApplicationView to register with the ApplicationService
 */
public synchronized void initComponents(ModularDockingApplicationView view) {

    // register self with applicationService and errorLogService within
    logger.debug("applicationService = " + applicationService);
    while (applicationService == null) {
        // idle in this thread
        try {
            this.wait(waitTime);
        } catch (InterruptedException e) {
            logger.warn("e.getMessage() = " + e.getMessage());
        }
    }
    // register this modular view with applicationService
    applicationService.registerFrameView(view);

    mainPanel = new JPanel(new BorderLayout());

    statusMessageLabel = new JLabel("Application started");
    statusMessageLabel.setHorizontalAlignment(SwingConstants.LEFT);
    statusMessageLabel.setVerticalAlignment(SwingConstants.CENTER);
    busyLabel = new JXBusyLabel(new Dimension(18, 19));
    BusyPainter painter = new BusyPainter(new RoundRectangle2D.Float(0, 0, 8.0f, 1.9f, 10.0f, 10.0f),
            new Ellipse2D.Float(2.5f, 2.5f, 14.0f, 14.0f));
    painter.setTrailLength(4);
    painter.setPoints(16);
    painter.setFrame(4);
    busyLabel.setPreferredSize(new Dimension(18, 19));
    busyLabel.setIcon(new EmptyIcon(18, 19));
    busyLabel.setBusyPainter(painter);
    busyLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

    // create progress bar
    progressBar = new JProgressBar(0, 100);
    progressBar.setVisible(false);
    progressBar.setName("progressBar"); // NOI18N
    mainPanel.setName("mainPanel"); // NOI18N
    statusMessageLabel.setName("statusMessageLabel"); // NOI18N
    busyLabel.setName("statusAnimationLabel"); // NOI18N

    // check workspace file exists
    createWorkspacePersistenceFile();

    // create menuBar
    createMenuBar();
    // create toolbar
    createToolBar();
    // create status bar
    createStatusBar();

    // set menubar
    setMenuBar(menuBar);
    // set toolbar
    setToolBar(toolBar);
    // set status bar
    setStatusBar(jxStatusBar);

    // create tool window
    initToolWindows();

    // set tool window to main content
    setComponent(toolWindowManager);

    // create task monitor and exit listeners
    createTasMonitorAndExitListeners();
}

From source file:wigraph.ShortestPathRelation.java

/**
 *
 *///from  ww w  .j a v a 2s .c o  m
private JPanel setUpControls() {
    JPanel jp = new JPanel();
    jp.setBackground(Color.WHITE);
    jp.setLayout(new BoxLayout(jp, BoxLayout.PAGE_AXIS));
    jp.setBorder(BorderFactory.createLineBorder(Color.black, 3));

    // jp_ss - word wist 1 (ss) horizontal panel
    JPanel jp_wl1 = new JPanel();
    jp_wl1.setLayout(new BoxLayout(jp_wl1, BoxLayout.X_AXIS));

    JLabel word1_label = new JLabel("List of words 1 separated by comma");//, Label.RIGHT)
    word_set1 = new JTextField(20);
    word1_label.setDisplayedMnemonic('W');
    word_set1.setFocusAccelerator('W');

    word_set1.setText(INITIAL_WORD_SET1);
    jp_wl1.add(word1_label);
    jp_wl1.add(word_set1);

    // jp_ss - word wist 1 (ss) horizontal panel
    JPanel jp_wl2 = new JPanel();
    jp_wl2.setLayout(new BoxLayout(jp_wl2, BoxLayout.X_AXIS));

    JLabel word2_label = new JLabel("List of words 2");//, Label.RIGHT)
    word_set2 = new JTextField(20);
    word2_label.setDisplayedMnemonic('o');
    word_set2.setFocusAccelerator('o');

    word_set2.setText(INITIAL_WORD_SET2);
    jp_wl2.add(word2_label);
    jp_wl2.add(word_set2);

    jp_wl2.add(Box.createRigidArea(new Dimension(5, 0)));
    jp_wl2.add(search_path_btn);

    jp.add(jp_wl1);
    jp.add(jp_wl2);

    result_len = new JTextField(20);
    jp.add(result_len);

    jp.add(new JLabel("Select a pair of vertices for which a shortest path will be displayed"));
    JPanel jp2 = new JPanel();
    jp2.add(new JLabel("vertex from", SwingConstants.LEFT));
    jp2.add(getSelectionBox(true));
    jp2.setBackground(Color.white);
    JPanel jp3 = new JPanel();
    jp3.add(new JLabel("vertex to", SwingConstants.LEFT));
    jp3.add(getSelectionBox(false));
    jp3.setBackground(Color.white);
    jp.add(jp2);
    jp.add(jp3);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    vv.setGraphMouse(graphMouse);
    JComboBox modeBox = graphMouse.getModeComboBox();
    jp.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    jp.add(modeBox);

    return jp;
}

From source file:wsattacker.sso.openid.attacker.gui.MainGui.java

private void removeBackgroundFromButton(JXButton button) {
    button.setHorizontalAlignment(SwingConstants.LEFT);
    button.setBorder(null);/*  w ww .j  a va 2 s . c  o  m*/
    button.setBorderPainted(false);
    button.setContentAreaFilled(false);
}

From source file:wsattacker.sso.openid.attacker.gui.MainGui.java

private void removeBackgroundFromButton(JButton button) {
    button.setHorizontalAlignment(SwingConstants.LEFT);
    button.setBorder(null);//from  w ww.j a va2  s.  com
    button.setBorderPainted(false);
    button.setContentAreaFilled(false);
}