Example usage for javax.swing Box createHorizontalGlue

List of usage examples for javax.swing Box createHorizontalGlue

Introduction

In this page you can find the example usage for javax.swing Box createHorizontalGlue.

Prototype

public static Component createHorizontalGlue() 

Source Link

Document

Creates a horizontal glue component.

Usage

From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java

/**
 * Method returning the selectionChartPanel
 *
 * @return the selection chart panel//  w  ww  .j a  v a 2 s  .co m
 */
private JPanel getSelectionChartPanel() {
    if (selectionChartPanel == null) {
        selectionChartPanel = new JPanel();
        selectionChartPanel.setLayout(new BoxLayout(selectionChartPanel, BoxLayout.X_AXIS));
        JLabel selectionChartLabel = new JLabel("Available charts: ");
        selectionChartPanel.add(selectionChartLabel);
        selectionChartPanel.add(Box.createHorizontalStrut(10));
        selectionChartPanel.add(getSelectionComboBox());
        selectionChartPanel.add(Box.createHorizontalGlue());

        if (Config.getBatchScheduler(G5kSite.getIndexForSite(siteName)).equalsIgnoreCase("OAR1")) {
            JButton button = new JButton("Jobs Gantt Chart");
            selectionChartPanel.add(button);
            button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    Iterator<String> iter = jobsMap.keySet().iterator();
                    ArrayList<GridJob> jobsList = new ArrayList<GridJob>();
                    while (iter.hasNext()) {
                        jobsList.add(jobsMap.get(iter.next()));
                    }
                    new GanttChart("Jobs Gantt Chart", siteName, jobsList, connection);
                }
            });
        }
    }
    return selectionChartPanel;
}

From source file:com.diversityarrays.kdxplore.heatmap.HeatMapPanel.java

public HeatMapPanel(VisualisationTool vtool, int unique, SelectedValueStore svs, PlotInfoProvider pip,
        String title,/*ww w  . j ava 2 s.  c  om*/

        HeatMapModelData<T> heatMapModelData, SuppressionHandler suppressionHandler) {
    super(title, svs, vtool.getVisualisationToolId(), unique, Arrays.asList(heatMapModelData.zTraitInstance),
            suppressionHandler);

    context = heatMapModelData.context;
    xValueRetriever = heatMapModelData.xValueRetriever;
    yValueRetriever = heatMapModelData.yValueRetriever;

    askAboutValueForUnscored = !ValueRetriever.isEitherOneXorY(xValueRetriever, yValueRetriever);

    traitInstanceValueRetriever = heatMapModelData.traitInstanceValueRetriever;
    this.zTraitInstance = heatMapModelData.zTraitInstance;
    //      this.plotSpecimensByPoint = heatMapModelData.model.getCellLegend();

    this.plotInfoProvider = pip;
    this.title = title;

    if (heatMapModelData.plotPointsByMark.isEmpty()) {
        markInfo = null;
    } else {
        markInfo = new MarkInfo(Msg.LABEL_MARK_INFO_PLOT_TYPE(), heatMapModelData.plotPointsByMark);
    }

    this.heatMap = createHeatMap(heatMapModelData);

    this.heatMap.addPropertyChangeListener(HeatMapPane.PROPERTY_SELECTION_CHANGE,
            heatMapPaneSelectionChangeListener);

    messagesTextArea.setEditable(false);
    tabbedPane.addTab(TAB_MESSAGES, new JScrollPane(messagesTextArea));
    tabbedPane.addTab(TAB_CURATION, createCurationControls());

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tabbedPane, heatMap);

    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.0);
    add(splitPane, BorderLayout.CENTER);

    int cellValueCount = heatMap.getValueModel().getUniqueCellValueCount();
    Gradient[] gradients = Gradient.createBuiltins(cellValueCount);
    Gradient initial = null;
    for (Gradient g : gradients) {
        if (Gradient.RAINBOW_NAME.equals(g.getName())) {
            initial = g;
            break;
        }
    }

    gradientComboBox = new JComboBox<Gradient>(gradients);
    gradientComboBox.setRenderer(new GradientComboBoxRenderer());
    gradientComboBox.addItemListener(gradientItemListener);

    // gradientItemListener will to model.setGradient()
    gradientComboBox.setSelectedItem(initial);

    Box box = Box.createHorizontalBox();
    box.add(syncedOption);
    box.add(gradientComboBox);
    box.add(Box.createHorizontalGlue());
    //      if (RunMode.getRunMode().isDeveloper()) {
    //           box.add(useBlankTilesOption);
    //      }
    box.add(new JSeparator(JSeparator.VERTICAL));
    box.add(opacityLabel);
    box.add(unselectedOpacitySpinner);

    add(box, BorderLayout.SOUTH);

    opacityLabel.setToolTipText("Sets the opacity of unselected cells");
    unselectedOpacitySpinner.setToolTipText("Sets the opacity of unselected cells");

    //      useBlankTilesOption.setSelected(heatMap.getUseBlankTiles());
    unselectedOpacityModel.setValue(heatMap.getUnselectedOpacity());

    //      useBlankTilesOption.addActionListener(new ActionListener() {
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //                handleUseBlankTilesChanged();
    //            }
    //        });

    unselectedOpacityModel.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            handleOpacityChange();
        }
    });

    updateMessagesWithMissingOrBad(null, heatMapModelData);

    applyDecoratorsToHeatMap(heatMapModelData);
}

From source file:diet.gridr.g5k.gui.G5kSummaryChart.java

/**
 * Method returning the chart selection panel
 *
 * @return panel for the selection of a chart to display
 *//*  w ww  . java2  s  .co m*/
private JPanel getChartSelectionPanel() {
    if (chartSelectionPanel == null) {
        chartSelectionPanel = new JPanel();
        chartSelectionPanel.setLayout(new BoxLayout(chartSelectionPanel, BoxLayout.X_AXIS));
        chartSelectionLabel = new JLabel("Available charts :");
        chartSelectionPanel.add(chartSelectionLabel);
        chartSelectionPanel.add(Box.createHorizontalStrut(10));
        chartSelectionPanel.add(getChartSelectionComboBox());
        chartSelectionPanel.add(Box.createHorizontalGlue());
    }
    return chartSelectionPanel;
}

From source file:com.diversityarrays.dal.server.ServerGui.java

public ServerGui(Image serverIconImage, IDalServer svr, DalServerFactory factory, File wwwRoot,
        DalServerPreferences prefs) {/*  w  w w.  j a  va2  s .co  m*/

    this.serverIconImage = serverIconImage;
    this.dalServerFactory = factory;
    this.wwwRoot = wwwRoot;
    this.preferences = prefs;

    JMenuBar menuBar = new JMenuBar();

    JMenu serverMenu = new JMenu("Server");
    menuBar.add(serverMenu);
    serverMenu.add(serverStartAction);
    serverMenu.add(serverStopAction);
    serverMenu.add(exitAction);

    JMenu commandMenu = new JMenu("Command");
    menuBar.add(commandMenu);
    commandMenu.add(doSql);

    JMenu urlMenu = new JMenu("URL");
    menuBar.add(urlMenu);
    urlMenu.add(new JMenuItem(copyDalUrlAction));
    urlMenu.add(new JMenuItem(showDalUrlQRcodeAction));

    setJMenuBar(menuBar);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    messages.setFont(GuiUtil.createMonospacedFont(12));
    messages.setEditable(false);

    setServer(svr);

    quietOption.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean q = quietOption.isSelected();
            if (server != null) {
                server.setQuiet(q);
            }
        }
    });

    JScrollPane scrollPane = new JScrollPane(messages, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    final JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();

    JButton clear = new JButton(new AbstractAction("Clear") {
        @Override
        public void actionPerformed(ActionEvent e) {
            messages.setText("");
        }
    });

    final boolean[] follow = new boolean[] { true };
    final JCheckBox followTail = new JCheckBox("Follow", follow[0]);

    followTail.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            follow[0] = followTail.isSelected();
        }
    });

    final OutputStream os = new OutputStream() {
        @Override
        public void write(int b) throws IOException {
            char ch = (char) b;
            messages.append(new Character(ch).toString());
            if (ch == '\n' && follow[0]) {
                verticalScrollBar.setValue(verticalScrollBar.getMaximum());
            }
        }
    };

    TeePrintStream pso = new TeePrintStream(System.out, os);
    TeePrintStream pse = new TeePrintStream(System.err, os);

    System.setErr(pse);
    System.setOut(pso);

    Box box = Box.createHorizontalBox();
    box.add(clear);
    box.add(followTail);
    box.add(quietOption);
    box.add(Box.createHorizontalGlue());

    JPanel bottom = new JPanel(new BorderLayout());
    bottom.add(BorderLayout.NORTH, box);
    bottom.add(BorderLayout.SOUTH, statusInfoLine);

    Container cp = getContentPane();
    cp.add(BorderLayout.CENTER, scrollPane);
    cp.add(BorderLayout.SOUTH, bottom);

    pack();
    setSize(640, 480);

    final MemoryUsageMonitor mum = new MemoryUsageMonitor();
    mum.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            statusInfoLine.setMessage(mum.getMemoryUsage());
        }
    });

    if (server == null) {
        // If initial server is null, allow user to specify
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowOpened(WindowEvent e) {
                removeWindowListener(this);
                serverStartAction.actionPerformed(null);
            }
        });
    } else {
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowOpened(WindowEvent e) {
                removeWindowListener(this);
                ensureDatabaseInitialisedThenStartServer();
            }
        });
    }
}

From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java

protected void showConfigurationPanel() {
    if (configurationPanel == null) {
        // setup configuration panel
        updateFrameworkResources();/*from   ww w .  jav a 2s  .com*/
        configurationPanel = new JPanel();
        configurationPanel.setLayout(new BorderLayout());
        configurationPanel.setBackground(COLOR_OUTER_BG);
        // setup logs panel

        ArrayList<String> values = new ArrayList<String>();
        Iterator<String> itr = logReaders.keySet().iterator();
        while (itr.hasNext()) {
            values.add(itr.next());
        }
        logsEnumeration = new GUIPropertyListEnumeration("Event Log :", null, values, null, 180);
        // initializing Logs
        RoundedPanel content = new RoundedPanel(10, 5, 5);
        content.setBackground(COLOR_BG);
        content.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        content.setLayout(new BoxLayout(content, BoxLayout.LINE_AXIS));
        content.add(logsEnumeration.getPropertyPanel());
        // initializing Time Sort
        initTimeSort();
        RoundedPanel content2 = new RoundedPanel(10, 5, 5);
        content2.setBackground(COLOR_BG);
        content2.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        content2.setLayout(new BoxLayout(content2, BoxLayout.LINE_AXIS));
        content2.add(timeUnitSort.getPropertyPanel());
        // initializing Measure
        ArrayList<String> values2 = new ArrayList<String>();
        values2.add(MEAN);
        values2.add(MEDIAN);
        values2.add(MIN);
        values2.add(HEUST1);
        values2.add(HEUST2);
        estimatorSort = new GUIPropertyListEnumeration("Estimator:", null, values2, null, 180);
        RoundedPanel content3 = new RoundedPanel(10, 5, 5);
        content3.setBackground(COLOR_BG);
        content3.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        content3.setLayout(new BoxLayout(content3, BoxLayout.LINE_AXIS));
        content3.add(estimatorSort.getPropertyPanel());

        // setup reference model / log configuration panel
        JPanel startPanel = new JPanel();
        startPanel.setOpaque(false);
        startPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        startPanel.setLayout(new BoxLayout(startPanel, BoxLayout.X_AXIS));
        startButton = new AutoFocusButton("start calculation");
        if (RuntimeUtils.isRunningMacOsX() == true) {
            startButton.setOpaque(true);
        }
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                startCalculation();
            }
        });
        startButton.setEnabled(true);
        startPanel.add(Box.createHorizontalGlue());
        startPanel.add(startButton);
        rightPanel = new JPanel();
        rightPanel.setOpaque(false);
        rightPanel.setBorder(BorderFactory.createEmptyBorder());
        rightPanel.setLayout(new BorderLayout());
        // blank panel
        JPanel blankPanel = new JPanel();
        blankPanel.setOpaque(false);
        blankPanel.setBorder(BorderFactory.createEmptyBorder());
        blankPanel.setLayout(new BorderLayout());

        JPanel leftPanel = new JPanel();
        leftPanel.setOpaque(false);
        leftPanel.setBorder(BorderFactory.createEmptyBorder());
        leftPanel.setLayout(new BorderLayout());
        leftPanel.add(content, BorderLayout.CENTER);
        leftPanel.add(content2, BorderLayout.SOUTH);
        leftPanel.add(content3, BorderLayout.NORTH);
        // add benchmark item list to west
        rightPanel.add(blankPanel, BorderLayout.CENTER);
        rightPanel.add(startPanel, BorderLayout.SOUTH);
        configurationPanel.add(leftPanel, BorderLayout.WEST);
        configurationPanel.add(rightPanel, BorderLayout.CENTER);
    }
    // switch to configuration view
    setView(configurationPanel);
}

From source file:com.diversityarrays.kdxplore.design.EntryFileImportDialog.java

public EntryFileImportDialog(Window owner, String title, File inputFile, Predicate<Role> entryHeadingFilter) {
    super(owner, title, ModalityType.APPLICATION_MODAL);

    this.entryHeadingFilter = entryHeadingFilter;
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    setGlassPane(backgroundRunner.getBlockingPane());

    useScrollBarOption.addActionListener(new ActionListener() {
        @Override//from  www.j a v a 2s.  c  o  m
        public void actionPerformed(ActionEvent e) {
            updateDataPreviewScrolling();
        }
    });

    headingRoleTableModel = createHeadingRoleTableModel();
    headingRoleTable = new HeadingRoleTable<>(headingRoleTableModel);
    headingTableScrollPane = new JScrollPane(headingRoleTable);
    GuiUtil.setVisibleRowCount(headingRoleTable, 10);

    JPanel roleAssignmentPanel = new JPanel(new BorderLayout());
    roleAssignmentPanel.add(headingTableScrollPane, BorderLayout.CENTER);

    headingRoleTable.setTransferHandler(flth);
    headingRoleTableModel.addChangeListener(headingRoleChangeListener);

    GuiUtil.setVisibleRowCount(dataPreviewTable, 10);
    dataPreviewTable.setTransferHandler(flth);
    dataPreviewScrollPane.setTransferHandler(flth);
    updateDataPreviewScrolling();

    dataPreviewScrollPane.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            //                boolean useScrollBar = useScrollBarOption.isSelected();
            GuiUtil.initialiseTableColumnWidths(dataPreviewTable, true);
        }
    });

    Box top = Box.createHorizontalBox();
    top.add(new JLabel("# rows to preview: "));
    top.add(new JSpinner(previewRowCountSpinnerModel));
    top.add(Box.createHorizontalGlue());
    top.add(useScrollBarOption);

    JPanel dataPreviewPanel = new JPanel(new BorderLayout());
    dataPreviewPanel.add(GuiUtil.createLabelSeparator("Data Preview", top), BorderLayout.NORTH);
    dataPreviewPanel.add(dataPreviewScrollPane, BorderLayout.CENTER);

    headingWarning.setForeground(Color.RED);
    JLabel instructions = new JLabel("<HTML>Please assign a <i>Role</i> for each of the headings in your data"
            + "<br>You must specify one as the <i>Entry Name</i>."
            + "<br>Click on one of the <i>Role</i> cells and select from the dropdown"
            + "<br>To assign multiple headings, select the rows for which you wish"
            + "<br>to set the <i>Role</i> then right-click and choose from the dropdown.");
    instructions.setHorizontalAlignment(JLabel.CENTER);
    instructions.setBackground(Toast.PALE_YELLOW);

    JScrollPane instScroll = new JScrollPane(instructions);
    instScroll.setBackground(Toast.PALE_YELLOW);

    normalEntryNameField.getDocument()
            .addDocumentListener(new DocumentChangeListener((e) -> updateAcceptButton()));
    normalEntryNameField.setText(TrialDesignPreferences.getInstance().getNormalEntryTypeName());

    JPanel rolesPanel = new JPanel();
    GBH gbh = new GBH(rolesPanel, 2, 2, 0, 0);
    int y = 0;
    gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, "Entry Type Name for non-Checks:");
    gbh.add(1, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, normalEntryNameField);
    gbh.add(2, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, saveForFuture);
    ++y;

    gbh.add(0, y, 3, 1, GBH.BOTH, 2, 1, GBH.CENTER, roleAssignmentPanel);
    ++y;

    JSplitPane headingsAndInstructions = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, rolesPanel, instScroll);

    JPanel headingPanel = new JPanel(new BorderLayout());
    headingPanel.add(GuiUtil.createLabelSeparator("Assign Roles for Headings"), BorderLayout.NORTH);
    headingPanel.add(headingsAndInstructions, BorderLayout.CENTER);
    headingPanel.add(headingWarning, BorderLayout.SOUTH);

    errorMessage.setEditable(false);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dataPreviewPanel, headingPanel);
    splitPane.setResizeWeight(0.5);

    cardPanel.add(new JScrollPane(errorMessage), CARD_ERROR);
    cardPanel.add(splitPane, CARD_DATA);

    Box bot = Box.createHorizontalBox();
    bot.add(Box.createHorizontalGlue());
    bot.add(new JButton(cancelAction));
    bot.add(new JButton(acceptAction));
    acceptAction.setEnabled(false);

    Container cp = getContentPane();
    cp.add(cardPanel, BorderLayout.CENTER);
    cp.add(bot, BorderLayout.SOUTH);
    pack();

    sheetNamesComboBox.addActionListener(sheetNamesActionListener);

    Timer timer = new Timer(true);

    previewRowCountSpinnerModel.addChangeListener(new ChangeListener() {
        int nPreview;
        TimerTask timerTask = null;

        @Override
        public void stateChanged(ChangeEvent e) {
            nPreview = previewRowCountSpinnerModel.getNumber().intValue();

            if (timerTask == null) {
                timerTask = new TimerTask() {
                    int lastPreviewCount = nPreview;

                    @Override
                    public void run() {
                        if (lastPreviewCount == nPreview) {
                            System.err.println("Stable at " + lastPreviewCount);
                            // No change, do it now
                            cancel();
                            try {
                                updateDataPreview(lastPreviewCount);
                            } finally {
                                timerTask = null;
                            }
                        } else {
                            System.err.println("Changing from " + lastPreviewCount + " to " + nPreview);
                            lastPreviewCount = nPreview;
                        }
                    }
                };
                timer.scheduleAtFixedRate(timerTask, 500, 100);
            }
        }
    });

    sheetNamesComboBox.setVisible(false);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            removeWindowListener(this);
            setFile(inputFile);
        }
    });
}

From source file:org.rdv.ui.ControlPanel.java

/**
 * Setup the UI./*  w  w w .ja  v  a 2  s.co  m*/
 */
private void initPanel() {
    setLayout(new BorderLayout());

    GridBagConstraints c = new GridBagConstraints();

    JPanel container = new JPanel();
    container.setLayout(new GridBagLayout());

    Box firstRowPanel = new Box(BoxLayout.LINE_AXIS);

    beginButton = new JButton();
    beginButton.setName("beginButton");
    beginButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setLocationBegin();
        }
    });
    firstRowPanel.add(beginButton);

    rtButton = new JButton();
    rtButton.setName("rtButton");
    rtButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (rtButton.isSelected()) {
                rbnbController.pause();
            } else {
                rbnbController.monitor();
            }
        }
    });
    firstRowPanel.add(rtButton);

    playButton = new JButton();
    playButton.setName("playButton");
    playButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (playButton.isSelected()) {
                rbnbController.pause();
            } else {
                rbnbController.play();
            }
        }
    });
    firstRowPanel.add(playButton);

    endButton = new JButton();
    endButton.setName("endButton");
    endButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setLocationEnd();
        }
    });
    firstRowPanel.add(endButton);

    firstRowPanel.add(Box.createHorizontalStrut(8));

    SpinnerListModel playbackRateModel = new SpinnerListModel(playbackRates);
    playbackRateSpinner = new JSpinner(playbackRateModel);
    playbackRateSpinner.setName("playbackRateSpinner");
    JSpinner.ListEditor playbackRateEditor = new JSpinner.ListEditor(playbackRateSpinner);
    playbackRateEditor.getTextField().setEditable(false);
    playbackRateSpinner.setEditor(playbackRateEditor);
    playbackRateSpinner.setPreferredSize(new Dimension(80, playbackRateSpinner.getPreferredSize().height));
    playbackRateSpinner.setMinimumSize(playbackRateSpinner.getPreferredSize());
    playbackRateSpinner.setMaximumSize(playbackRateSpinner.getPreferredSize());
    playbackRateSpinner.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            playbackRateChanged();
        }
    });
    firstRowPanel.add(playbackRateSpinner);

    firstRowPanel.add(Box.createHorizontalStrut(8));

    timeScaleComboBox = new JComboBox();
    timeScaleComboBox.setName("timeScaleComboBox");
    timeScaleComboBox.setEditable(true);
    timeScaleComboBox.setPreferredSize(new Dimension(96, timeScaleComboBox.getPreferredSize().height));
    timeScaleComboBox.setMinimumSize(timeScaleComboBox.getPreferredSize());
    timeScaleComboBox.setMaximumSize(timeScaleComboBox.getPreferredSize());
    for (int i = 0; i < timeScales.length; i++) {
        timeScaleComboBox.addItem(DataViewer.formatSeconds(timeScales[i]));
    }
    timeScaleComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            timeScaleChange();
        }
    });
    firstRowPanel.add(timeScaleComboBox);

    firstRowPanel.add(Box.createHorizontalGlue());

    locationButton = new JButton();
    locationButton.setName("locationButton");
    locationButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            TimeRange timeRange = RBNBHelper.getChannelsTimeRange();
            double time = DateTimeDialog.showDialog(ControlPanel.this, rbnbController.getLocation(),
                    timeRange.start, timeRange.end);
            if (time >= 0) {
                rbnbController.setLocation(time);
            }
        }
    });
    firstRowPanel.add(locationButton);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 8, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(firstRowPanel, c);

    zoomTimeSlider = new TimeSlider();
    zoomTimeSlider.setRangeChangeable(false);
    zoomTimeSlider.addTimeAdjustmentListener(this);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(0, 8, 0, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(zoomTimeSlider, c);

    JPanel zoomTimePanel = new JPanel();
    zoomTimePanel.setLayout(new BorderLayout());

    zoomMinimumLabel = new JLabel();
    zoomMinimumLabel.setName("zoomMinimumLabel");
    zoomTimePanel.add(zoomMinimumLabel, BorderLayout.WEST);

    zoomRangeLabel = new JLabel();
    zoomRangeLabel.setName("zoomRangeLabel");
    zoomRangeLabel.setHorizontalAlignment(JLabel.CENTER);
    zoomTimePanel.add(zoomRangeLabel, BorderLayout.CENTER);

    zoomMaximumLabel = new JLabel();
    zoomMaximumLabel.setName("zoomMaximumLabel");
    zoomTimePanel.add(zoomMaximumLabel, BorderLayout.EAST);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 0, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(zoomTimePanel, c);

    globalTimeSlider = new TimeSlider();
    globalTimeSlider.setValueChangeable(false);
    globalTimeSlider.addTimeAdjustmentListener(this);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 1;
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 8, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(globalTimeSlider, c);

    add(container, BorderLayout.CENTER);

    log.info("Initialized control panel.");
}

From source file:medsavant.uhn.cancer.AddNewCommentDialog.java

private JPanel getMainPanel() {
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    if (selectedOntologyTerm == null) {
        mainPanel.add(getHeader(/*from w w  w. j a  v a2 s.  c  o  m*/
                UserCommentApp.getDefaultOntologyType().name() + " terms associated with this variant"));
        JButton selectNoneButton = new JButton("Clear Selections");
        selectNoneButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                clearSelections();
            }
        });
        mainPanel.add(selectNoneButton);
        mainPanel.add(getOntologyTermsForThisVariant());
        mainPanel.add(getHeader("Comment"));
    } else {
        mainPanel.add(getHeader("Comment for " + UserCommentApp.getDefaultOntologyType().name() + " term "
                + selectedOntologyTerm.getName()));
    }

    commentBox = new JTextArea("", DEFAULT_COMMENTBOX_WIDTH, DEFAULT_COMMENTBOX_HEIGHT);
    commentBox.setLineWrap(true);
    JPanel textBoxPanel = new JPanel();
    textBoxPanel.setLayout(new BoxLayout(textBoxPanel, BoxLayout.X_AXIS));
    textBoxPanel.add(Box.createHorizontalGlue());
    textBoxPanel.add(new JScrollPane(commentBox));
    textBoxPanel.add(Box.createHorizontalGlue());

    mainPanel.add(textBoxPanel);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());
    JButton OKButton = new JButton("OK");
    OKButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                String sessID = LoginController.getSessionID();
                int projId = ProjectController.getInstance().getCurrentProjectID();
                int refId = ReferenceController.getInstance().getCurrentReferenceID();
                UserCommentGroup lcg = MedSavantClient.VariantManager.getUserCommentGroup(sessID, projId, refId,
                        variantRecord);
                if (lcg == null) {
                    lcg = MedSavantClient.VariantManager.createUserCommentGroup(sessID, projId, refId,
                            variantRecord);
                }
                submitComment(lcg);
                dispose();
            } catch (Exception ex) {
                ex.printStackTrace();
                LOG.error("Error: ", ex);
                DialogUtils.displayException("Error", ex.getLocalizedMessage(), ex);
            }
        }
    });
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    buttonPanel.add(OKButton);
    buttonPanel.add(cancelButton);
    buttonPanel.add(Box.createHorizontalGlue());
    mainPanel.add(buttonPanel);
    return mainPanel;
}

From source file:net.pandoragames.far.ui.swing.dialog.SettingsDialog.java

private void init() {
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
    this.setResizable(false);

    JPanel basePanel = new JPanel();
    basePanel.setLayout(new BoxLayout(basePanel, BoxLayout.Y_AXIS));
    basePanel.setBorder(/*from w  w  w  . ja  v a2 s . c o m*/
            BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING));
    registerCloseWindowKeyListener(basePanel);

    // sink for error messages
    MessageLabel errorField = new MessageLabel();
    errorField.setMinimumSize(new Dimension(100, swingConfig.getStandardComponentHight()));
    errorField.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    TwoComponentsPanel lineError = new TwoComponentsPanel(errorField,
            Box.createRigidArea(new Dimension(1, swingConfig.getStandardComponentHight())));
    lineError.setAlignmentX(Component.LEFT_ALIGNMENT);
    basePanel.add(lineError);

    // character set
    JLabel labelCharset = new JLabel(swingConfig.getLocalizer().localize("label.default-characterset"));
    labelCharset.setAlignmentX(Component.LEFT_ALIGNMENT);
    basePanel.add(labelCharset);

    JComboBox listCharset = new JComboBox(swingConfig.getCharsetList().toArray());
    listCharset.setAlignmentX(Component.LEFT_ALIGNMENT);
    listCharset.setSelectedItem(swingConfig.getDefaultCharset());
    listCharset.setEditable(true);
    listCharset.setMaximumSize(
            new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, swingConfig.getStandardComponentHight()));

    listCharset.addActionListener(new CharacterSetListener(errorField));
    listCharset.setEditor(new CharacterSetEditor(errorField));
    basePanel.add(listCharset);

    basePanel.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING)));

    // select the group selector
    JPanel selectorPanel = new JPanel();
    selectorPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    selectorPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    // linePattern.setAlignmentX( Component.LEFT_ALIGNMENT );
    JLabel labelSelector = new JLabel(swingConfig.getLocalizer().localize("label.group-ref-indicator"));
    selectorPanel.add(labelSelector);
    JComboBox selectorBox = new JComboBox(FARConfig.GROUPREFINDICATORLIST);
    selectorBox.setSelectedItem(Character.toString(groupReference));
    selectorBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            JComboBox cbox = (JComboBox) event.getSource();
            String indicator = (String) cbox.getSelectedItem();
            groupReference = indicator.charAt(0);
        }
    });
    selectorPanel.add(selectorBox);
    basePanel.add(selectorPanel);

    basePanel.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING)));

    // checkbox DO BACKUP
    JCheckBox doBackupFlag = new JCheckBox(swingConfig.getLocalizer().localize("label.create-backup"));
    doBackupFlag.setAlignmentX(Component.LEFT_ALIGNMENT);
    doBackupFlag.setHorizontalTextPosition(SwingConstants.LEADING);
    doBackupFlag.setSelected(replaceForm.isDoBackup());
    doBackupFlag.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            doBackup = ItemEvent.SELECTED == event.getStateChange();
            backupFlagEvent = event;
        }
    });
    basePanel.add(doBackupFlag);

    JTextField backupDirPathTextField = new JTextField();
    backupDirPathTextField.setPreferredSize(
            new Dimension(SwingConfig.COMPONENT_WIDTH, swingConfig.getStandardComponentHight()));
    backupDirPathTextField.setMaximumSize(
            new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, swingConfig.getStandardComponentHight()));
    backupDirPathTextField.setText(backupDirectory.getPath());
    backupDirPathTextField.setToolTipText(backupDirectory.getPath());
    backupDirPathTextField.setEditable(false);
    JButton openBaseDirFileChooserButton = new JButton(swingConfig.getLocalizer().localize("button.browse"));
    BrowseButtonListener backupDirButtonListener = new BrowseButtonListener(backupDirPathTextField,
            new BackUpDirectoryRepository(swingConfig, findForm, replaceForm, errorField),
            swingConfig.getLocalizer().localize("label.choose-backup-directory"));
    openBaseDirFileChooserButton.addActionListener(backupDirButtonListener);
    TwoComponentsPanel lineBaseDir = new TwoComponentsPanel(backupDirPathTextField,
            openBaseDirFileChooserButton);
    lineBaseDir.setAlignmentX(Component.LEFT_ALIGNMENT);
    basePanel.add(lineBaseDir);

    basePanel.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING)));

    JPanel fileInfoPanel = new JPanel();
    fileInfoPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                    swingConfig.getLocalizer().localize("label.default-file-info")));
    fileInfoPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    fileInfoPanel.setLayout(new BoxLayout(fileInfoPanel, BoxLayout.Y_AXIS));
    JLabel fileInfoLabel = new JLabel(swingConfig.getLocalizer().localize("message.displayed-in-info-column"));
    fileInfoLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    fileInfoPanel.add(fileInfoLabel);
    fileInfoPanel.add(Box.createHorizontalGlue());
    JRadioButton nothingRadio = new JRadioButton(swingConfig.getLocalizer().localize("label.nothing"));
    nothingRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    nothingRadio.setActionCommand(SwingConfig.DefaultFileInfo.NOTHING.name());
    nothingRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.NOTHING);
    fileInfoOptions.add(nothingRadio);
    fileInfoPanel.add(nothingRadio);
    JRadioButton readOnlyRadio = new JRadioButton(
            swingConfig.getLocalizer().localize("label.read-only-warning"));
    readOnlyRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    readOnlyRadio.setActionCommand(SwingConfig.DefaultFileInfo.READONLY.name());
    readOnlyRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.READONLY);
    fileInfoOptions.add(readOnlyRadio);
    fileInfoPanel.add(readOnlyRadio);
    JRadioButton sizeRadio = new JRadioButton(swingConfig.getLocalizer().localize("label.filesize"));
    sizeRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    sizeRadio.setActionCommand(SwingConfig.DefaultFileInfo.SIZE.name());
    sizeRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.SIZE);
    fileInfoOptions.add(sizeRadio);
    fileInfoPanel.add(sizeRadio);
    JCheckBox showPlainBytesFlag = new JCheckBox(
            "  " + swingConfig.getLocalizer().localize("label.show-plain-bytes"));
    showPlainBytesFlag.setAlignmentX(Component.LEFT_ALIGNMENT);
    showPlainBytesFlag.setHorizontalTextPosition(SwingConstants.LEADING);
    showPlainBytesFlag.setSelected(swingConfig.isShowPlainBytes());
    showPlainBytesFlag.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            showBytes = ItemEvent.SELECTED == event.getStateChange();
        }
    });
    fileInfoPanel.add(showPlainBytesFlag);
    JRadioButton lastModifiedRadio = new JRadioButton(
            swingConfig.getLocalizer().localize("label.last-modified"));
    lastModifiedRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    lastModifiedRadio.setActionCommand(SwingConfig.DefaultFileInfo.LAST_MODIFIED.name());
    lastModifiedRadio
            .setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.LAST_MODIFIED);
    fileInfoOptions.add(lastModifiedRadio);
    fileInfoPanel.add(lastModifiedRadio);
    basePanel.add(fileInfoPanel);

    // buttons
    JPanel buttonPannel = new JPanel();
    buttonPannel.setAlignmentX(Component.LEFT_ALIGNMENT);
    buttonPannel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    // cancel
    JButton cancelButton = new JButton(swingConfig.getLocalizer().localize("button.cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            SettingsDialog.this.dispose();
        }
    });
    buttonPannel.add(cancelButton);
    // save
    JButton saveButton = new JButton(swingConfig.getLocalizer().localize("button.save"));
    saveButton.addActionListener(new SaveButtonListener());
    buttonPannel.add(saveButton);
    this.getRootPane().setDefaultButton(saveButton);

    this.add(basePanel);
    this.add(buttonPannel);
    placeOnScreen(swingConfig.getScreenCenter());
}

From source file:org.colombbus.tangara.ConfigurationWindow.java

/**
 * This method initializes bottomPanel//from   w  ww.j  a  v a2 s  .  com
 *
 * @return javax.swing.JPanel
 */
private JPanel getBottomPanel() {
    if (bottomPanel == null) {
        bottomPanel = new JPanel();
        bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
        bottomPanel.add(getRestoreButton());
        bottomPanel.add(Box.createHorizontalStrut(10));
        bottomPanel.add(getSaveButton());
        bottomPanel.add(Box.createHorizontalGlue());
        bottomPanel.add(getCancelButton());
        bottomPanel.setBorder(new EmptyBorder(MARGIN_Y, MARGIN_X, MARGIN_X, MARGIN_Y));
    }
    return bottomPanel;
}