Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

In this page you can find the example usage for java.awt BorderLayout EAST.

Prototype

String EAST

To view the source code for java.awt BorderLayout EAST.

Click Source Link

Document

The east layout constraint (right side of container).

Usage

From source file:ca.phon.app.project.ProjectWindow.java

private MultiActionButton createCorpusButton() {
    MultiActionButton retVal = new MultiActionButton();

    ImageIcon newIcn = IconManager.getInstance().getIcon("places/folder", IconSize.SMALL);

    String s1 = "Corpus";
    String s2 = "Enter corpus name and press enter.  Press escape to cancel.";

    retVal.getTopLabel().setText(WorkspaceTextStyler.toHeaderText(s1));
    retVal.getTopLabel().setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    retVal.getTopLabel().setFont(FontPreferences.getTitleFont());
    retVal.getTopLabel().setIcon(newIcn);
    retVal.setAlwaysDisplayActions(true);

    retVal.setOpaque(false);//from   w ww  . java 2  s  . co m

    ImageIcon cancelIcn = IconManager.getInstance().getIcon("actions/button_cancel", IconSize.SMALL);
    ImageIcon cancelIcnL = cancelIcn;

    PhonUIAction btnSwapAct = new PhonUIAction(this, "onSwapNewAndCreateCorpus", retVal);
    btnSwapAct.putValue(Action.ACTION_COMMAND_KEY, "CANCEL_CREATE_ITEM");
    btnSwapAct.putValue(Action.NAME, "Cancel create");
    btnSwapAct.putValue(Action.SHORT_DESCRIPTION, "Cancel create");
    btnSwapAct.putValue(Action.SMALL_ICON, cancelIcn);
    btnSwapAct.putValue(Action.LARGE_ICON_KEY, cancelIcnL);
    retVal.addAction(btnSwapAct);

    JPanel corpusNamePanel = new JPanel(new BorderLayout());
    corpusNamePanel.setOpaque(false);

    final JTextField corpusNameField = new JTextField();
    corpusNameField.setDocument(new NameDocument());
    corpusNameField.setText("Corpus Name");
    corpusNamePanel.add(corpusNameField, BorderLayout.CENTER);

    ActionMap actionMap = retVal.getActionMap();
    actionMap.put(btnSwapAct.getValue(Action.ACTION_COMMAND_KEY), btnSwapAct);
    InputMap inputMap = retVal.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);

    inputMap.put(ks, btnSwapAct.getValue(Action.ACTION_COMMAND_KEY));

    retVal.setActionMap(actionMap);
    retVal.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);

    PhonUIAction createNewCorpusAct = new PhonUIAction(this, "onCreateCorpus", corpusNameField);
    createNewCorpusAct.putValue(Action.SHORT_DESCRIPTION, "Create new corpus folder");
    createNewCorpusAct.putValue(Action.SMALL_ICON,
            IconManager.getInstance().getIcon("actions/list-add", IconSize.SMALL));

    JButton createBtn = new JButton(createNewCorpusAct);
    corpusNamePanel.add(createBtn, BorderLayout.EAST);

    corpusNameField.setAction(createNewCorpusAct);

    // swap bottom component in new project button
    retVal.setBottomLabelText(WorkspaceTextStyler.toDescText(s2));
    retVal.add(corpusNamePanel, BorderLayout.CENTER);

    retVal.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
        }

        @Override
        public void focusGained(FocusEvent e) {
            corpusNameField.requestFocus();
        }
    });

    return retVal;
}

From source file:com.att.aro.diagnostics.GraphPanel.java

/**
 * Initializes a new instance of the GraphPanel class.
 *//*from   www  .  j  ava 2  s .c  o m*/
public GraphPanel() {

    subplotMap.put(ChartPlotOptions.GPS,
            new GraphPanelPlotLabels(rb.getString("chart.gps"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.RADIO,
            new GraphPanelPlotLabels(rb.getString("chart.radio"), createRadioPlot(), 2));
    subplotMap.put(ChartPlotOptions.BLUETOOTH,
            new GraphPanelPlotLabels(rb.getString("chart.bluetooth"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.CAMERA,
            new GraphPanelPlotLabels(rb.getString("chart.camera"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.SCREEN,
            new GraphPanelPlotLabels(rb.getString("chart.screen"), createBarPlot(new Color(34, 177, 76)), 1));
    subplotMap.put(ChartPlotOptions.BATTERY,
            new GraphPanelPlotLabels(rb.getString("chart.battery"), createBatteryPlot(), 2));
    subplotMap.put(ChartPlotOptions.WAKELOCK,
            new GraphPanelPlotLabels(rb.getString("chart.wakelock"), createWakelockStatePlot(), 1));
    subplotMap.put(ChartPlotOptions.WIFI,
            new GraphPanelPlotLabels(rb.getString("chart.wifi"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.ALARM,
            new GraphPanelPlotLabels(rb.getString("chart.alarm"), createAlarmPlot(), 2));
    subplotMap.put(ChartPlotOptions.NETWORK_TYPE,
            new GraphPanelPlotLabels(rb.getString("chart.networkType"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.THROUGHPUT,
            new GraphPanelPlotLabels(rb.getString("chart.throughput"), createThroughputPlot(), 2));
    subplotMap.put(ChartPlotOptions.BURSTS,
            new GraphPanelPlotLabels(rb.getString("chart.bursts"), createBurstPlot(), 1));
    subplotMap.put(ChartPlotOptions.USER_INPUT,
            new GraphPanelPlotLabels(rb.getString("chart.userInput"), createUserEventPlot(), 1));
    subplotMap.put(ChartPlotOptions.RRC,
            new GraphPanelPlotLabels(rb.getString("chart.rrc"), createRrcPlot(), 1));
    subplotMap.put(ChartPlotOptions.CPU,
            new GraphPanelPlotLabels(rb.getString("chart.cpu"), createCpuPlot(), 1));

    this.pp = new PacketPlots();
    subplotMap.put(ChartPlotOptions.UL_PACKETS,
            new GraphPanelPlotLabels(rb.getString("chart.ul"), pp.getUlPlot(), 1));
    subplotMap.put(ChartPlotOptions.DL_PACKETS,
            new GraphPanelPlotLabels(rb.getString("chart.dl"), pp.getDlPlot(), 1));

    this.axis = new NumberAxis();
    this.axis.setStandardTickUnits(UNITS);
    this.axis.setRange(new Range(0, DEFAULT_TIMELINE));
    this.axis.setLowerBound(0);

    this.axis.setAutoTickUnitSelection(true);
    this.axis.setTickMarkInsideLength(1);
    this.axis.setTickMarkOutsideLength(1);

    this.axis.setMinorTickMarksVisible(true);
    this.axis.setMinorTickMarkInsideLength(2f);
    this.axis.setMinorTickMarkOutsideLength(2f);
    this.axis.setTickMarkInsideLength(4f);
    this.axis.setTickMarkOutsideLength(4f);

    this.axisLabel = new JLabel(rb.getString("chart.timeline"));
    this.axisLabel.setHorizontalAlignment(SwingConstants.CENTER);

    this.setLayout(new BorderLayout());
    this.setPreferredSize(new Dimension(200, 310));
    this.add(getZoomSavePanel(), BorderLayout.EAST);
    this.add(getPane(), BorderLayout.CENTER);
    this.add(getLabelsPanel(), BorderLayout.WEST);

    setChartOptions(UserPreferences.getInstance().getChartPlotOptions());
}

From source file:com.xilinx.kintex7.MainScreen.java

private Container createContentPane() {
    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.setOpaque(true);//from   w  w w.ja v a  2  s  .c o m

    mainPanel = new JPanel(new BorderLayout());

    mainPanel.setBounds(0, 0, minWidth, minHeight);
    testPanel = new JPanel(new BorderLayout());

    testPanel.add(testAndStats(), BorderLayout.CENTER);

    mainPanel.add(testPanel, BorderLayout.LINE_START);

    //Make the center component big, since that's the
    //typical usage of BorderLayout.
    tabs = new JTabbedPane();

    mainPanel.add(tabs, BorderLayout.CENTER);

    tabs.add("System Monitor", pciInfo());
    tabs.add("Performance Plots", plotPanel());

    mainPanel.setOpaque(true);

    try {
        imagePanel = new ImageBackgroundPanel(blockDiagram, false);
    } catch (Exception e) {
    }
    /*imagePanel.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("Design Block Diagram"),
                BorderFactory.createEmptyBorder(5,5,5,5)));*/
    imagePanel.setBackground(Color.WHITE);
    imagePanel.setSize(minWidth, minHeight);

    imagePanel.setLocation(0, 0);
    imagePanel.setOpaque(true);

    final JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(minWidth, minHeight));
    layeredPane.add(mainPanel, JLayeredPane.DEFAULT_LAYER, 0);
    layeredPane.add(imagePanel, JLayeredPane.DEFAULT_LAYER, 0);
    layeredPane.addComponentListener(new ComponentListener() {

        @Override
        public void componentResized(ComponentEvent ce) {
            mainPanel.setBounds(0, 0, Math.max(minWidth, layeredPane.getWidth()),
                    Math.max(minHeight, layeredPane.getHeight()));
            if (layeredPane.getWidth() > 1024) {
                tplotPanel.setPreferredSize(new Dimension(300, 100));
            } else {
                tplotPanel.setPreferredSize(new Dimension(200, 100));
            }
            imagePanel.setSize(mainPanel.getWidth(), mainPanel.getHeight());
            imagePanel.setLocation(0, 0);
            mainPanel.repaint();
        }

        @Override
        public void componentMoved(ComponentEvent ce) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void componentShown(ComponentEvent ce) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public void componentHidden(ComponentEvent ce) {
            //throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    // on top, but invisible initially
    imagePanel.setVisible(false);

    JPanel bpanel = new JPanel(new BorderLayout());

    final JButton button = new JButton(
            "<html><b>B<br>L<br>O<br>C<br>K<br> <br>D<br>I<br>A<br>G<br>R<br>A<br>M<br></b></html>");
    button.setToolTipText("Click here to see the block diagram");
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            adjustSelectionPanel();
        }
    });

    bpanel.add(button, BorderLayout.CENTER);

    contentPane.add(layeredPane, BorderLayout.CENTER);
    contentPane.add(button, BorderLayout.EAST);
    JLabel mLabel = new JLabel(modeText, JLabel.CENTER);
    mLabel.setFont(new Font(modeText, Font.BOLD, 15));
    contentPane.add(mLabel, BorderLayout.PAGE_START);
    return contentPane;
}

From source file:com.openbravo.pos.sales.JRetailTicketPreviewTicket.java

/** This method is called from within the constructor to
 * initialize the form./*from  w  w  w . j  a  v  a  2  s.c  o  m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    buttonGroup1 = new javax.swing.ButtonGroup();
    m_jOptions = new javax.swing.JPanel();
    m_jButtons = new javax.swing.JPanel();
    m_jTicketId = new javax.swing.JLabel();
    jButtonSearch = new javax.swing.JButton();
    //    m_jEdit = new javax.swing.JButton();
    m_jRefund = new javax.swing.JButton();
    m_jPrint = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    m_jPanelTicket = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    // m_jKeys = new com.openbravo.editor.JEditorKeys();
    //        jPanel5 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    //        m_jTicketEditor = new com.openbravo.editor.JEditorIntegerPositive();
    jPanel1 = new javax.swing.JPanel();
    //        jrbSales = new javax.swing.JRadioButton();
    //     jrbRefunds = new javax.swing.JRadioButton();

    setLayout(new java.awt.BorderLayout());

    m_jOptions.setLayout(new java.awt.BorderLayout());

    m_jButtons.setPreferredSize(new java.awt.Dimension(506, 56));
    m_jButtons.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    m_jTicketId.setBackground(java.awt.Color.white);
    m_jTicketId.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    m_jTicketId.setBorder(javax.swing.BorderFactory.createCompoundBorder(
            javax.swing.BorderFactory
                    .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")),
            javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
    m_jTicketId.setOpaque(true);
    m_jTicketId.setPreferredSize(new java.awt.Dimension(160, 25));
    m_jTicketId.setRequestFocusEnabled(false);
    m_jButtons.add(m_jTicketId, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 15, -1, 30));

    jButtonSearch.setBackground(new java.awt.Color(255, 255, 255));
    jButtonSearch
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/search.png"))); // NOI18N
    jButtonSearch.setText(AppLocal.getIntString("label.search")); // NOI18N
    jButtonSearch.setFocusPainted(false);
    jButtonSearch.setFocusable(false);
    jButtonSearch.setMargin(new java.awt.Insets(0, 0, 0, 0));
    jButtonSearch.setRequestFocusEnabled(false);
    jButtonSearch.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonSearchActionPerformed(evt);
        }
    });
    m_jButtons.add(jButtonSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 12, 85, 35));

    //        m_jEdit.setBackground(new java.awt.Color(255, 255, 255));
    //        m_jEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/edit.png"))); // NOI18N
    //        m_jEdit.setText(AppLocal.getIntString("button.edit")); // NOI18N
    //        m_jEdit.setFocusPainted(false);
    //        m_jEdit.setFocusable(false);
    //        m_jEdit.setMargin(new java.awt.Insets(8, 14, 8, 14));
    //        m_jEdit.setRequestFocusEnabled(false);
    //        m_jEdit.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                m_jEditActionPerformed(evt);
    //            }
    //        });
    //        m_jButtons.add(m_jEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(258, 12, 85, 35));

    //        m_jRefund.setBackground(new java.awt.Color(255, 255, 255));
    //        m_jRefund.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/inbox.png"))); // NOI18N
    //        m_jRefund.setText(AppLocal.getIntString("button.refund")); // NOI18N
    //        m_jRefund.setFocusPainted(false);
    //        m_jRefund.setFocusable(false);
    //        m_jRefund.setMargin(new java.awt.Insets(8, 14, 8, 14));
    //        m_jRefund.setRequestFocusEnabled(false);
    //        m_jRefund.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                m_jRefundActionPerformed(evt);
    //            }
    //        });
    //        m_jButtons.add(m_jRefund, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 10, 50, 35));

    m_jPrint.setBackground(new java.awt.Color(255, 255, 255));
    m_jPrint.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/yast_printer.png"))); // NOI18N
    m_jPrint.setText(AppLocal.getIntString("button.print")); // NOI18N
    m_jPrint.setFocusPainted(false);
    m_jPrint.setFocusable(false);
    m_jPrint.setMargin(new java.awt.Insets(0, 0, 0, 0));
    m_jPrint.setRequestFocusEnabled(false);
    m_jPrint.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            m_jPrintActionPerformed(evt);
        }
    });
    m_jButtons.add(m_jPrint, new org.netbeans.lib.awtextra.AbsoluteConstraints(258, 12, 85, 35));

    m_jOptions.add(m_jButtons, java.awt.BorderLayout.WEST);

    jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
    m_jOptions.add(jPanel2, java.awt.BorderLayout.CENTER);

    add(m_jOptions, java.awt.BorderLayout.NORTH);

    m_jPanelTicket.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    m_jPanelTicket.setLayout(new java.awt.BorderLayout());
    add(m_jPanelTicket, java.awt.BorderLayout.CENTER);

    jPanel3.setLayout(new java.awt.BorderLayout());

    jPanel4.setPreferredSize(new java.awt.Dimension(175, 276));
    jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));

    //        m_jKeys.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                m_jKeysActionPerformed(evt);
    //            }
    //        });
    //        jPanel4.add(m_jKeys);

    //  jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    //  jPanel5.setPreferredSize(new java.awt.Dimension(201, 60));
    //  jPanel5.setLayout(new java.awt.GridBagLayout());

    //        jButton1.setBackground(new java.awt.Color(255, 255, 255));
    //        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/button_ok.png"))); // NOI18N
    //        jButton1.setFocusPainted(false);
    //        jButton1.setFocusable(false);
    //        jButton1.setMargin(new java.awt.Insets(8, 14, 8, 14));
    //        jButton1.setRequestFocusEnabled(false);
    //        jButton1.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                jButton1ActionPerformed(evt);
    //            }
    //        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    //        jPanel5.add(jButton1, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    //   jPanel5.add(m_jTicketEditor, gridBagConstraints);

    //  jPanel4.add(jPanel5);

    jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);

    jPanel1.setPreferredSize(new java.awt.Dimension(130, 25));

    //        buttonGroup1.add(jrbSales);
    //        jrbSales.setText(AppLocal.getIntString("label.sales")); // NOI18N
    //        jrbSales.setFocusPainted(false);
    //        jrbSales.setFocusable(false);
    //        jrbSales.setRequestFocusEnabled(false);
    //        jPanel1.add(jrbSales);

    //        buttonGroup1.add(jrbRefunds);
    //        jrbRefunds.setText(AppLocal.getIntString("label.refunds")); // NOI18N
    //        jrbRefunds.setFocusPainted(false);
    //        jrbRefunds.setFocusable(false);
    //        jrbRefunds.setRequestFocusEnabled(false);
    //        jPanel1.add(jrbRefunds);

    jPanel3.add(jPanel1, java.awt.BorderLayout.CENTER);

    add(jPanel3, java.awt.BorderLayout.EAST);
}

From source file:jduagui.Controller.java

private JPanel addSwingNode() {
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    JLabel n = new JLabel("testing SwingNode north");
    JLabel s = new JLabel("testing SwingNode south");
    JLabel w = new JLabel("testing SwingNode west");
    JLabel e = new JLabel("testing SwingNode east");
    JLabel c = new JLabel("testing SwingNode center");
    p.add(c, BorderLayout.CENTER);
    p.add(n, BorderLayout.NORTH);
    p.add(s, BorderLayout.SOUTH);
    p.add(w, BorderLayout.WEST);/*www  .ja  v  a  2  s .c o m*/
    p.add(e, BorderLayout.EAST);
    return p;
}

From source file:op.controlling.PnlControlling.java

private JPanel createContentPanel4Fall() {
    JPanel pnlContent = new JPanel(new VerticalLayout());

    /***/*  www.j  a  v  a 2s.c o m*/
     *      _____     _ _          _
     *     |  ___|_ _| | |___     / \   _ __   ___  _ __  _   _ _ __ ___   ___  _   _ ___
     *     | |_ / _` | | / __|   / _ \ | '_ \ / _ \| '_ \| | | | '_ ` _ \ / _ \| | | / __|
     *     |  _| (_| | | \__ \  / ___ \| | | | (_) | | | | |_| | | | | | | (_) | |_| \__ \
     *     |_|  \__,_|_|_|___/ /_/   \_\_| |_|\___/|_| |_|\__, |_| |_| |_|\___/ \__,_|___/
     *                                                    |___/
     */
    JPanel pnlFallsAnon = new JPanel(new BorderLayout());
    final JButton btnFallsAnon = GUITools.createHyperlinkButton("opde.controlling.nursing.falls.anonymous",
            null, null);
    int fallsMonthsBack;
    try {
        fallsMonthsBack = Integer.parseInt(OPDE.getProps().getProperty("opde.controlling::fallsMonthsBack"));
    } catch (NumberFormatException nfe) {
        fallsMonthsBack = 7;
    }
    final JTextField txtFallsMonthsBack = GUITools.createIntegerTextField(1, 120, fallsMonthsBack);
    txtFallsMonthsBack.setToolTipText(SYSTools.xx("misc.msg.monthsback"));

    btnFallsAnon.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    SYSPropsTools.storeProp("opde.controlling::fallsMonthsBack", txtFallsMonthsBack.getText(),
                            OPDE.getLogin().getUser());
                    SYSFilesTools.print(ResInfoTools.getFallsAnonymous(
                            Integer.parseInt(txtFallsMonthsBack.getText()), progressClosure), false);
                    return null;
                }

                @Override
                protected void done() {
                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    pnlFallsAnon.add(btnFallsAnon, BorderLayout.WEST);
    pnlFallsAnon.add(txtFallsMonthsBack, BorderLayout.EAST);
    pnlContent.add(pnlFallsAnon);

    /***
     *      _____     _ _       _           ____           _     _            _
     *     |  ___|_ _| | |___  | |__  _   _|  _ \ ___  ___(_) __| | ___ _ __ | |_
     *     | |_ / _` | | / __| | '_ \| | | | |_) / _ \/ __| |/ _` |/ _ \ '_ \| __|
     *     |  _| (_| | | \__ \ | |_) | |_| |  _ <  __/\__ \ | (_| |  __/ | | | |_
     *     |_|  \__,_|_|_|___/ |_.__/ \__, |_| \_\___||___/_|\__,_|\___|_| |_|\__|
     *                                |___/
     */
    JPanel pnlFallsRes = new JPanel(new BorderLayout());
    final JButton btnFallsRes = GUITools.createHyperlinkButton("opde.controlling.nursing.falls.byResident",
            null, null);
    int fallsResMonthsBack;
    try {
        fallsResMonthsBack = Integer
                .parseInt(OPDE.getProps().getProperty("opde.controlling::fallsResMonthsBack"));
    } catch (NumberFormatException nfe) {
        fallsResMonthsBack = 7;
    }
    final JTextField txtResFallsMonthsBack = GUITools.createIntegerTextField(1, 120, fallsResMonthsBack);
    txtResFallsMonthsBack.setToolTipText(SYSTools.xx("misc.msg.monthsback"));

    btnFallsRes.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    SYSPropsTools.storeProp("opde.controlling::fallsResMonthsBack",
                            txtResFallsMonthsBack.getText(), OPDE.getLogin().getUser());
                    SYSFilesTools.print(ResInfoTools.getFallsByResidents(
                            Integer.parseInt(txtResFallsMonthsBack.getText()), progressClosure), false);
                    return null;
                }

                @Override
                protected void done() {
                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };
            worker.execute();
        }
    });
    pnlFallsRes.add(btnFallsRes, BorderLayout.WEST);
    pnlFallsRes.add(txtResFallsMonthsBack, BorderLayout.EAST);
    pnlContent.add(pnlFallsRes);

    /***
     *      _____     _ _     ___           _ _           _
     *     |  ___|_ _| | |___|_ _|_ __   __| (_) ___ __ _| |_ ___  _ __
     *     | |_ / _` | | / __|| || '_ \ / _` | |/ __/ _` | __/ _ \| '__|
     *     |  _| (_| | | \__ \| || | | | (_| | | (_| (_| | || (_) | |
     *     |_|  \__,_|_|_|___/___|_| |_|\__,_|_|\___\__,_|\__\___/|_|
     *
     */
    JPanel pnlFallsIndicator = new JPanel(new BorderLayout());
    final JButton btnFallsIndicator = GUITools
            .createHyperlinkButton("opde.controlling.nursing.fallsindicators.byMonth", null, null);
    int fallsIndicatorBack;
    try {
        fallsIndicatorBack = Integer
                .parseInt(OPDE.getProps().getProperty("opde.controlling::fallsIndicatorMonthsBack"));
    } catch (NumberFormatException nfe) {
        fallsIndicatorBack = 7;
    }
    final JTextField txtFallsIndicatorsMonthsBack = GUITools.createIntegerTextField(1, 120, fallsIndicatorBack);
    txtFallsIndicatorsMonthsBack.setToolTipText(SYSTools.xx("misc.msg.monthsback"));

    btnFallsIndicator.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            OPDE.getMainframe().setBlocked(true);
            SwingWorker worker = new SwingWorker() {
                @Override
                protected Object doInBackground() throws Exception {
                    SYSPropsTools.storeProp("opde.controlling::fallsIndicatorMonthsBack",
                            txtFallsIndicatorsMonthsBack.getText(), OPDE.getLogin().getUser());
                    return ResInfoTools.getFallsIndicatorsByMonth(
                            Integer.parseInt(txtFallsIndicatorsMonthsBack.getText()), progressClosure);
                }

                @Override
                protected void done() {
                    try {
                        SYSFilesTools.print(get().toString(), true);
                    } catch (ExecutionException ee) {
                        OPDE.fatal(ee);
                    } catch (InterruptedException ie) {
                        // nop
                    }

                    OPDE.getDisplayManager().setProgressBarMessage(null);
                    OPDE.getMainframe().setBlocked(false);
                }
            };

            worker.execute();

        }
    });
    pnlFallsIndicator.add(btnFallsIndicator, BorderLayout.WEST);
    pnlFallsIndicator.add(txtFallsIndicatorsMonthsBack, BorderLayout.EAST);
    pnlContent.add(pnlFallsIndicator);

    return pnlContent;
}

From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java

/**
 * Initialize GUI components.//from   w ww .j  ava2  s  . c o m
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initGUI() {

    App.init();

    // setBounds(100, 100, 972, 439);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setIconImage(Builder.getApplicationIcon());
    setTitle("Sample Size Analysis");
    getContentPane().setLayout(new MigLayout("", "[1136px,grow,fill]", "[30px][405px,grow]"));

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    getContentPane().add(toolBar, "cell 0 0,growx,aligny top");

    JToolBarButton btnOpen = new JToolBarButton(actionBrowse);
    btnOpen.setIcon(Builder.getImageIcon("fileopen.png"));
    toolBar.add(btnOpen);

    JToolBarButton btnSave = new JToolBarButton(actionSaveTable);
    btnSave.setIcon(Builder.getImageIcon("save.png"));
    toolBar.add(btnSave);

    JToolBarButton btnExportPDF = new JToolBarButton(actionExportPDF);
    btnExportPDF.setIcon(Builder.getImageIcon("pdf.png"));
    toolBar.add(btnExportPDF);

    JToolBarButton btnExportPNG = new JToolBarButton(actionExportPNG);
    btnExportPNG.setIcon(Builder.getImageIcon("formatpng.png"));
    toolBar.add(btnExportPNG);

    toolBar.addSeparator();

    JToolBarButton btnRun = new JToolBarButton(actionRun);
    btnRun.setIcon(Builder.getImageIcon("run.png"));
    toolBar.add(btnRun);

    JPanel panelMain = new JPanel();
    getContentPane().add(panelMain, "cell 0 1,grow");
    panelMain.setLayout(new BorderLayout(0, 0));

    JSplitPane splitPaneMain = new JSplitPane();
    splitPaneMain.setOneTouchExpandable(true);
    panelMain.add(splitPaneMain);

    JPanel panelParameters = new JPanel();
    splitPaneMain.setLeftComponent(panelParameters);
    panelParameters.setLayout(new MigLayout("", "[grow,right]", "[][][][193.00,grow,fill][]"));

    JPanel panelInput = new JPanel();
    panelInput.setBorder(new TitledBorder(null, "Input", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelInput, "cell 0 0,grow");
    panelInput.setLayout(new MigLayout("", "[100px:100px:180px,right][grow,fill][]", "[]"));

    JLabel lblInputFile = new JLabel("Input file:");
    panelInput.add(lblInputFile, "cell 0 0");

    txtInputFile = new JTextField();
    panelInput.add(txtInputFile, "cell 1 0,growx");
    txtInputFile.setActionCommand("NewFileTyped");
    txtInputFile.addActionListener(this);
    txtInputFile.setColumns(10);

    JButton btnBrowse = new JButton("");
    panelInput.add(btnBrowse, "cell 2 0");
    btnBrowse.setAction(actionBrowse);
    btnBrowse.setText("");
    btnBrowse.setIcon(Builder.getImageIcon("fileopen16.png"));
    btnBrowse.setPreferredSize(new Dimension(25, 25));
    btnBrowse.setMaximumSize(new Dimension(25, 25));
    btnBrowse.putClientProperty("JButton.buttonType", "segmentedTextured");
    btnBrowse.putClientProperty("JButton.segmentPosition", "middle");

    JPanel panelAnalysisOptions = new JPanel();
    panelAnalysisOptions.setBorder(new TitledBorder(null, "Analysis and filtering options",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelAnalysisOptions, "cell 0 1,grow");
    panelAnalysisOptions.setLayout(new MigLayout("", "[100px:100px:180px,right][grow][][]", "[][][][][]"));

    JLabel lblEventTypes = new JLabel("Event type:");
    panelAnalysisOptions.add(lblEventTypes, "cell 0 0");

    cboEventType = new JComboBox();
    panelAnalysisOptions.add(cboEventType, "cell 1 0 3 1");
    cboEventType.setModel(new DefaultComboBoxModel(EventTypeToProcess.values()));
    new EventTypeWrapper(cboEventType, PrefKey.EVENT_TYPE_TO_PROCESS, EventTypeToProcess.FIRE_EVENT);

    chkCommonYears = new JCheckBox("<html>Only analyze years all series have in common");
    chkCommonYears.setEnabled(false);
    new CheckBoxWrapper(chkCommonYears, PrefKey.SSIZ_CHK_COMMON_YEARS, false);
    panelAnalysisOptions.add(chkCommonYears, "cell 1 1 3 1");

    chkExcludeSeriesWithNoEvents = new JCheckBox("<html>Exclude series/segments with no events");
    chkExcludeSeriesWithNoEvents.setEnabled(false);
    new CheckBoxWrapper(chkExcludeSeriesWithNoEvents, PrefKey.SSIZ_CHK_EXCLUDE_SERIES_WITH_NO_EVENTS, false);
    panelAnalysisOptions.add(chkExcludeSeriesWithNoEvents, "cell 1 2 3 1");

    JLabel lblThresholdType = new JLabel("Threshold:");
    panelAnalysisOptions.add(lblThresholdType, "cell 0 3");

    cboThresholdType = new JComboBox();
    panelAnalysisOptions.add(cboThresholdType, "cell 1 3");
    cboThresholdType.setModel(new DefaultComboBoxModel(FireFilterType.values()));
    new FireFilterTypeWrapper(cboThresholdType, PrefKey.COMPOSITE_FILTER_TYPE_WITH_ALL_TREES,
            FireFilterType.NUMBER_OF_EVENTS);

    JLabel label = new JLabel(">=");
    panelAnalysisOptions.add(label, "flowx,cell 2 3");

    spnThresholdValueGT = new JSpinner();
    panelAnalysisOptions.add(spnThresholdValueGT, "cell 3 3");
    spnThresholdValueGT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    new SpinnerWrapper(spnThresholdValueGT, PrefKey.COMPOSITE_FILTER_VALUE, 1);

    chkEnableLessThan = new JCheckBox("");
    chkEnableLessThan.setActionCommand("LessThanThresholdStatus");
    chkEnableLessThan.addActionListener(this);
    panelAnalysisOptions.add(chkEnableLessThan, "flowx,cell 1 4,alignx right");

    lblLessThan = new JLabel("<=");
    lblLessThan.setEnabled(false);
    panelAnalysisOptions.add(lblLessThan, "cell 2 4");

    spnThresholdValueLT = new JSpinner();
    spnThresholdValueLT.setEnabled(false);
    spnThresholdValueLT.setModel(new SpinnerNumberModel(1, 1, 999, 1));
    panelAnalysisOptions.add(spnThresholdValueLT, "cell 3 4");

    lblAnd = new JLabel("and");
    panelAnalysisOptions.add(lblAnd, "cell 1 4");

    JPanel panelSimulations = new JPanel();
    panelSimulations.setBorder(
            new TitledBorder(null, "Simulations", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelParameters.add(panelSimulations, "cell 0 2,grow");
    panelSimulations.setLayout(new MigLayout("", "[100px:100px:180px,right][fill]", "[][][]"));

    JLabel lblSimulations = new JLabel("Simulations:");
    panelSimulations.add(lblSimulations, "cell 0 0");

    spnSimulations = new JSpinner();
    panelSimulations.add(spnSimulations, "cell 1 0");
    spnSimulations.setModel(new SpinnerNumberModel(new Integer(1000), new Integer(1), null, new Integer(1)));
    new SpinnerWrapper(spnSimulations, PrefKey.SSIZ_SIMULATION_COUNT, 1000);

    JLabel lblSeedNumber = new JLabel("Seed number:");
    panelSimulations.add(lblSeedNumber, "cell 0 1");

    spnSeed = new JSpinner();
    panelSimulations.add(spnSeed, "cell 1 1");
    spnSeed.setModel(new SpinnerNumberModel(new Integer(30188), null, null, new Integer(1)));
    new SpinnerWrapper(spnSeed, PrefKey.SSIZ_SEED_NUMBER, 30188);

    JLabel lblResampling = new JLabel("Resampling:");
    panelSimulations.add(lblResampling, "cell 0 2");

    cboResampling = new JComboBox();
    panelSimulations.add(cboResampling, "cell 1 2");
    cboResampling
            .setModel(new DefaultComboBoxModel(new String[] { "With replacement", "Without replacement" }));
    new ResamplingTypeWrapper(cboResampling, PrefKey.SSIZ_RESAMPLING_TYPE, ResamplingType.WITH_REPLACEMENT);

    segmentationPanel = new SegmentationPanel();
    segmentationPanel.chkSegmentation.setText("Process subset or segments of dataset?");
    segmentationPanel.chkSegmentation.setEnabled(false);
    panelParameters.add(segmentationPanel, "cell 0 3,growx");

    JPanel panel_3 = new JPanel();
    panelParameters.add(panel_3, "cell 0 4,grow");
    panel_3.setLayout(new MigLayout("", "[left][grow][right]", "[]"));

    JButton btnReset = new JButton("Reset");
    btnReset.setActionCommand("Reset");
    btnReset.addActionListener(this);
    panel_3.add(btnReset, "cell 0 0,grow");

    JButton btnRunAnalysis = new JButton("Run Analysis");
    btnRunAnalysis.setAction(actionRun);
    panel_3.add(btnRunAnalysis, "cell 2 0,grow");

    JPanel panelResults = new JPanel();
    splitPaneMain.setRightComponent(panelResults);
    panelResults.setLayout(new BorderLayout(0, 0));

    splitPaneResults = new JSplitPane();
    splitPaneResults.setResizeWeight(0.5);
    splitPaneResults.setOneTouchExpandable(true);
    splitPaneResults.setDividerLocation(0.5d);
    panelResults.add(splitPaneResults, BorderLayout.CENTER);
    splitPaneResults.setOrientation(JSplitPane.VERTICAL_SPLIT);

    JPanel panelResultsTop = new JPanel();
    splitPaneResults.setLeftComponent(panelResultsTop);
    panelResultsTop.setLayout(new BorderLayout(0, 0));

    JPanel panelChartOptions = new JPanel();
    panelChartOptions.setBackground(Color.WHITE);
    panelResultsTop.add(panelChartOptions, BorderLayout.SOUTH);
    panelChartOptions.setLayout(new MigLayout("", "[][][][][][grow][grow]", "[15px,center]"));

    JLabel lblNewLabel = new JLabel("Plot:");
    panelChartOptions.add(lblNewLabel, "cell 0 0,alignx trailing,aligny center");

    cboChartMetric = new JComboBox();
    cboChartMetric.setEnabled(false);
    cboChartMetric.setModel(new DefaultComboBoxModel(MiddleMetric.values()));
    panelChartOptions.add(cboChartMetric, "cell 1 0,growx");
    cboChartMetric.setBackground(Color.WHITE);

    JLabel lblOfSegment = new JLabel("of segment:");
    panelChartOptions.add(lblOfSegment, "cell 2 0,alignx trailing");

    cboSegment = new JComboBox();
    cboSegment.setBackground(Color.WHITE);
    cboSegment.setActionCommand("UpdateChart");
    cboSegment.addActionListener(this);

    panelChartOptions.add(cboSegment, "cell 3 0,growx");
    cboChartMetric.setActionCommand("UpdateChart");

    JLabel lblWithAsymptoteType = new JLabel("with asymptote type:");
    panelChartOptions.add(lblWithAsymptoteType, "cell 4 0,alignx trailing");

    JComboBox comboBox = new JComboBox();
    comboBox.setEnabled(false);
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "none", "Weibull", "Michaelis-Menten",
            "Modified Michaelis-Menten", "Logistic", "Modified exponential" }));
    comboBox.setBackground(Color.WHITE);
    panelChartOptions.add(comboBox, "cell 5 0,growx");
    cboChartMetric.addActionListener(this);

    panelChart = new JPanel();
    panelChart.setMinimumSize(new Dimension(200, 200));
    panelResultsTop.add(panelChart, BorderLayout.CENTER);
    panelChart.setLayout(new BorderLayout(0, 0));
    panelChart.setBackground(Color.WHITE);

    JTabbedPane panelResultsBottom = new JTabbedPane(JTabbedPane.BOTTOM);
    splitPaneResults.setRightComponent(panelResultsBottom);

    simulationsTable = new SSIZResultsTable();
    simulationsTable.setEnabled(false);
    simulationsTable.addMouseListener(new TablePopClickListener());
    simulationsTable.setVisibleRowCount(10);

    adapter = new JTableSpreadsheetByRowAdapter(simulationsTable);

    scrollPaneSimulations = new JScrollPane();
    panelResultsBottom.addTab("Simulations", null, scrollPaneSimulations, null);
    scrollPaneSimulations.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneSimulations.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneSimulations.setViewportView(simulationsTable);

    JPanel panelAsymptote = new JPanel();

    asymptoteTable = new AsymptoteTable();
    asymptoteTable.setEnabled(false);
    // asymptoteTable.addMouseListener(new TablePopClickListener());
    asymptoteTable.setVisibleRowCount(10);

    scrollPaneAsymptote = new JScrollPane();

    scrollPaneAsymptote.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPaneAsymptote.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneAsymptote.setViewportView(asymptoteTable);
    panelAsymptote.setLayout(new BorderLayout());
    panelAsymptote.add(scrollPaneAsymptote, BorderLayout.CENTER);
    panelResultsBottom.addTab("Asymptote", null, panelAsymptote, null);

    // Disable asymptote tab until it is implemented
    panelResultsBottom.setEnabledAt(1, false);

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

    btnCancelAnalysis = new JButton("Cancel");
    btnCancelAnalysis.setIcon(Builder.getImageIcon("delete.png"));
    btnCancelAnalysis.setVisible(false);
    btnCancelAnalysis.setActionCommand("CancelAnalysis");
    btnCancelAnalysis.addActionListener(this);

    progressBar = new JProgressBar();
    panelProgressBar.add(progressBar, BorderLayout.CENTER);
    panelProgressBar.add(btnCancelAnalysis, BorderLayout.EAST);
    progressBar.setStringPainted(true);

    fileDialogWasUsed = false;
    mouseListenersActive = false;

    this.setGUIForFHFileReader();
    this.setGUIForThresholdStatus();

    pack();
    this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    setVisible(true);
}

From source file:org.pentaho.reporting.ui.datasources.pmd.PmdDataSourceEditor.java

protected Component createContentPane() {
    final JPanel queryTextAreaHeaderPanel = new JPanel(new BorderLayout());
    queryTextAreaHeaderPanel.add(new JLabel(Messages.getString("PmdDataSourceEditor.QueryLabel")),
            BorderLayout.WEST);//from   w ww .j  av a  2s . com
    queryTextAreaHeaderPanel.add(queryDesignerButton, BorderLayout.EAST);

    final JPanel queryConfigurationPanel = new JPanel();
    queryConfigurationPanel.setLayout(new BorderLayout());
    queryConfigurationPanel.add(queryTextAreaHeaderPanel, BorderLayout.NORTH);
    queryConfigurationPanel.add(new RTextScrollPane(700, 500, queryTextArea, true), BorderLayout.CENTER);

    final JTabbedPane queryScriptTabPane = new JTabbedPane();
    queryScriptTabPane.addTab(Messages.getString("PmdDataSourceEditor.StaticQuery"), queryConfigurationPanel);
    queryScriptTabPane.addTab(Messages.getString("PmdDataSourceEditor.QueryScripting"), createQueryScriptTab());

    final JPanel queryAreaPanel = new JPanel();
    queryAreaPanel.setLayout(new BorderLayout());
    queryAreaPanel.add(createGlobalPropertiesPanel(), BorderLayout.NORTH);
    queryAreaPanel.add(queryScriptTabPane, BorderLayout.CENTER);

    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(Messages.getString("PmdDataSourceEditor.DataSource"), queryAreaPanel);
    tabbedPane.addTab(Messages.getString("PmdDataSourceEditor.GlobalScripting"), createGlobalScriptTab());

    final JPanel contentPanel = new JPanel(new BorderLayout());
    contentPanel.add(tabbedPane, BorderLayout.CENTER);
    contentPanel.add(createPreviewButtonsPanel(), BorderLayout.SOUTH);
    contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    return contentPanel;
}

From source file:org.pentaho.reporting.tools.configeditor.ConfigDescriptionEditor.java

/**
 * Creates the enumeration detail editor.
 *
 * @return the enumeration detail editor.
 *///from   w w  w  .j a va  2s.c  o  m
private JPanel createEnumerationEditor() {
    enumEntryEditField = new JTextField();
    enumEntryListModel = new DefaultListModel();

    enumEntryList = new JList(enumEntryListModel);
    enumEntryList.addListSelectionListener(new EnumerationListSelectionHandler());

    final JPanel listPanel = new JPanel();
    listPanel.setLayout(new BorderLayout());
    listPanel.add(enumEntryEditField, BorderLayout.NORTH);
    listPanel.add(new JScrollPane(enumEntryList), BorderLayout.CENTER);

    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(5, 1));
    buttonPanel.add(new JButton(new AddEnumEntryAction()));
    buttonPanel.add(new JButton(new RemoveEnumEntryAction()));
    buttonPanel.add(new JButton(new UpdateEnumEntryAction()));
    buttonPanel.add(new JPanel());
    buttonPanel.add(new JButton(new SetBooleanEnumEntryAction()));

    final JPanel buttonCarrier = new JPanel();
    buttonCarrier.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
    buttonCarrier.add(buttonPanel);

    final JPanel editorPanel = new JPanel();
    editorPanel.setLayout(new BorderLayout());
    editorPanel.add(listPanel, BorderLayout.CENTER);
    editorPanel.add(buttonCarrier, BorderLayout.EAST);
    return editorPanel;
}

From source file:pt.lsts.neptus.plugins.sunfish.awareness.SituationAwareness.java

@Override
public void setActive(boolean mode, StateRenderer2D source) {
    super.setActive(mode, source);
    Container parent = source.getParent();
    while (parent != null && !(parent.getLayout() instanceof BorderLayout))
        parent = parent.getParent();/*ww  w . ja v  a 2s  . c  o  m*/
    if (mode) {
        JPanel panel = new JPanel(new BorderLayout());
        panel.add(slider, BorderLayout.CENTER);
        panel.add(minTimeLabel, BorderLayout.WEST);
        panel.add(maxTimeLabel, BorderLayout.EAST);
        parent.add(panel, BorderLayout.SOUTH);
    } else {
        parent = slider.getParent().getParent();
        parent.remove(slider.getParent());
    }
    parent.invalidate();
    parent.validate();
    parent.repaint();

}