Example usage for java.awt.event ComponentAdapter ComponentAdapter

List of usage examples for java.awt.event ComponentAdapter ComponentAdapter

Introduction

In this page you can find the example usage for java.awt.event ComponentAdapter ComponentAdapter.

Prototype

ComponentAdapter

Source Link

Usage

From source file:net.sourceforge.entrainer.gui.EntrainerFX.java

private void unexpandTitledPanes() {
    unexpandeTitledPane(sliderControlPane);
    unexpandeTitledPane(animations);/*  w  ww.  ja  va 2  s .  co  m*/
    unexpandeTitledPane(shimmerOptions);
    unexpandeTitledPane(neuralizer);
    unexpandeTitledPane(pictures);

    setMinimumSize(new Dimension(mainPanel.getPreferredSize().width, getHeight() / 2));

    addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            resizeBackground();
        }
    });
}

From source file:org.carrot2.workbench.vis.aduna.AdunaClusterMapViewPage.java

private void createAdunaControl(Composite parent) {
    /*/*from   www .j a  va  2 s .  c o  m*/
     * If <code>true</code>, try some dirty hacks to avoid flicker on Windows.
     */
    final boolean windowsFlickerHack = true;
    if (windowsFlickerHack) {
        System.setProperty("sun.awt.noerasebackground", "true");
    }

    this.scrollable = new Composite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrollable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    final GridLayout layout = new GridLayout();
    layout.marginBottom = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginTop = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    scrollable.setLayout(layout);

    embedded = new Composite(scrollable, SWT.NO_BACKGROUND | SWT.EMBEDDED);
    embedded.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    final Frame frame = SWT_AWT.new_Frame(embedded);
    frame.setLayout(new java.awt.BorderLayout());

    // LINGO-446: flicker fix; see "Creating a Root Pane Container" in http://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html
    final JApplet applet = new JApplet();
    frame.add(applet);
    applet.setLayout(new java.awt.BorderLayout());

    final JScrollPane scrollPanel = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_NEVER,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPanel.setDoubleBuffered(true);

    scrollPanel.setBorder(BorderFactory.createEmptyBorder());
    applet.getContentPane().add(scrollPanel, java.awt.BorderLayout.CENTER);

    final ClusterMapFactory factory = ClusterMapFactory.createFactory();
    final ClusterMap clusterMap = factory.createClusterMap();
    final ClusterMapMediator mapMediator = factory.createMediator(clusterMap);
    this.mapMediator = mapMediator;

    final ClusterGraphPanel graphPanel = mapMediator.getGraphPanel();
    graphPanel.setDoubleBuffered(true);
    scrollPanel.setViewportView(graphPanel);

    scrollable.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            updateScrollBars();
        }
    });

    final SelectionAdapter adapter = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            ScrollBar hbar = scrollable.getHorizontalBar();
            ScrollBar vbar = scrollable.getVerticalBar();
            final java.awt.Rectangle viewport = new java.awt.Rectangle(hbar.getSelection(), vbar.getSelection(),
                    hbar.getThumb(), vbar.getThumb());
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    graphPanel.scrollRectToVisible(viewport);
                }
            });
        }
    };
    scrollable.getVerticalBar().addSelectionListener(adapter);
    scrollable.getHorizontalBar().addSelectionListener(adapter);

    final Runnable updateScrollBarsAsync = new Runnable() {
        public void run() {
            updateScrollBars();
        }
    };

    graphPanel.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentShown(ComponentEvent e) {
            graphPanelSize = graphPanel.getPreferredSize();
            Display.getDefault().asyncExec(updateScrollBarsAsync);
        }

        @Override
        public void componentResized(ComponentEvent e) {
            graphPanelSize = graphPanel.getPreferredSize();
            Display.getDefault().asyncExec(updateScrollBarsAsync);
        }
    });
}

From source file:op.controlling.PnlQMSSchedule.java

/**
 * This method is called from within the constructor to
 * initialize the form.//w ww .  j a va  2s  . c o  m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    panelMain = new JPanel();
    lblMeasure = new JLabel();
    txtQMS = new JTextField();
    lblLocation = new JLabel();
    cmbLocation = new TreeComboBox();
    tabWdh = new JideTabbedPane();
    pnlDaily = new JPanel();
    lblEveryDay = new JLabel();
    spinTaeglich = new JSpinner();
    lblDays = new JLabel();
    btnJedenTag = new JButton();
    pnlWeekly = new JPanel();
    panel3 = new JPanel();
    btnJedeWoche = new JButton();
    lblEveryWeek = new JLabel();
    spinWoche = new JSpinner();
    lblWeeks = new JLabel();
    lblUhrzeit2 = new JideLabel();
    lblUhrzeit3 = new JideLabel();
    lblUhrzeit4 = new JideLabel();
    lblUhrzeit5 = new JideLabel();
    lblUhrzeit6 = new JideLabel();
    lblUhrzeit7 = new JideLabel();
    lblUhrzeit8 = new JideLabel();
    cbMon = new JRadioButton();
    cbDie = new JRadioButton();
    cbMit = new JRadioButton();
    cbDon = new JRadioButton();
    cbFre = new JRadioButton();
    cbSam = new JRadioButton();
    cbSon = new JRadioButton();
    pnlMonthly = new JPanel();
    lblEveryMonth = new JLabel();
    spinMonat = new JSpinner();
    lblMonth = new JLabel();
    btnJedenMonat = new JButton();
    llblOnDayOfMonth = new JLabel();
    spinDayInMonth = new JSpinner();
    cmbTag = new JComboBox<>();
    pnlYearly = new JPanel();
    lblEveryYear = new JLabel();
    spinYearly = new JSpinner();
    lblYear = new JLabel();
    btnEveryYear = new JButton();
    lblOnDay = new JLabel();
    spinDayInMonthInYear = new JSpinner();
    cmbMonth = new JComboBox();
    lblLDate = new JLabel();
    jdcStartingOn = new JDateChooser();
    jScrollPane1 = new JScrollPane();
    txtBemerkung = new JTextArea();
    btnSave = new JButton();
    lblDueDays = new JLabel();
    txtDueDays = GUITools.createIntegerTextField(1, 31, 1);

    //======== this ========
    setLayout(new BorderLayout());

    //======== panelMain ========
    {
        panelMain.setBorder(new LineBorder(Color.black, 2, true));
        panelMain.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                panelMainComponentResized(e);
            }
        });
        panelMain.setLayout(new FormLayout("$rgap, $lcgap, 35dlu:grow, $ugap, 105dlu:grow, $lcgap, $rgap",
                "default, $nlgap, 18dlu, $lgap, default, $nlgap, 2*(default, $lgap), pref, $lgap, default, $nlgap, default, $lgap, 72dlu:grow, $lgap, default, $lgap, $rgap"));

        //---- lblMeasure ----
        lblMeasure.setText("text");
        lblMeasure.setFont(new Font("Arial", Font.PLAIN, 10));
        lblMeasure.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblMeasure, CC.xy(5, 1));

        //---- txtQMS ----
        txtQMS.setFont(new Font("Arial", Font.BOLD, 14));
        panelMain.add(txtQMS, CC.xywh(3, 3, 3, 1, CC.DEFAULT, CC.FILL));

        //---- lblLocation ----
        lblLocation.setText("text");
        lblLocation.setFont(new Font("Arial", Font.PLAIN, 10));
        lblLocation.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblLocation, CC.xy(5, 5));
        panelMain.add(cmbLocation, CC.xy(5, 7));

        //======== tabWdh ========
        {

            //======== pnlDaily ========
            {
                pnlDaily.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.setLayout(new FormLayout("2*(default), $rgap, $lcgap, 40dlu, $rgap, default",
                        "default, $lgap, pref, $lgap, default"));

                //---- lblEveryDay ----
                lblEveryDay.setText("alle");
                lblEveryDay.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(lblEveryDay, CC.xy(2, 3));

                //---- spinTaeglich ----
                spinTaeglich.setFont(new Font("Arial", Font.PLAIN, 14));
                spinTaeglich.setModel(new SpinnerNumberModel(1, null, null, 1));
                pnlDaily.add(spinTaeglich, CC.xy(5, 3));

                //---- lblDays ----
                lblDays.setText("Tage");
                lblDays.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(lblDays, CC.xy(7, 3));

                //---- btnJedenTag ----
                btnJedenTag.setText("Jeden Tag");
                btnJedenTag.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenTagActionPerformed(e);
                    }
                });
                pnlDaily.add(btnJedenTag, CC.xywh(2, 5, 6, 1));
            }
            tabWdh.addTab("T\u00e4glich", pnlDaily);

            //======== pnlWeekly ========
            {
                pnlWeekly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlWeekly.setLayout(new FormLayout("default, 7*(13dlu), $lcgap, default:grow",
                        "$ugap, $lgap, default, $lgap, fill:53dlu:grow, $nlgap, default:grow, $lgap, $rgap"));

                //======== panel3 ========
                {
                    panel3.setLayout(
                            new FormLayout("default, $rgap, 40dlu, $rgap, 2*(default), $lcgap, default, $lcgap",
                                    "default:grow, $lgap, default"));

                    //---- btnJedeWoche ----
                    btnJedeWoche.setText("Jede Woche");
                    btnJedeWoche.setFont(new Font("Arial", Font.PLAIN, 14));
                    btnJedeWoche.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            btnJedeWocheActionPerformed(e);
                        }
                    });
                    panel3.add(btnJedeWoche, CC.xywh(3, 3, 3, 1));

                    //---- lblEveryWeek ----
                    lblEveryWeek.setText("alle");
                    lblEveryWeek.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(lblEveryWeek, CC.xy(1, 1));
                    panel3.add(spinWoche, CC.xy(3, 1));

                    //---- lblWeeks ----
                    lblWeeks.setText("Wochen am");
                    lblWeeks.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(lblWeeks, CC.xy(5, 1));
                }
                pnlWeekly.add(panel3, CC.xywh(2, 3, 9, 1));

                //---- lblUhrzeit2 ----
                lblUhrzeit2.setText("montags");
                lblUhrzeit2.setOrientation(1);
                lblUhrzeit2.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit2.setClockwise(false);
                lblUhrzeit2.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit2, CC.xy(2, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit3 ----
                lblUhrzeit3.setText("dienstags");
                lblUhrzeit3.setOrientation(1);
                lblUhrzeit3.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit3.setClockwise(false);
                lblUhrzeit3.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit3, CC.xy(3, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit4 ----
                lblUhrzeit4.setText("mittwochs");
                lblUhrzeit4.setOrientation(1);
                lblUhrzeit4.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit4.setClockwise(false);
                lblUhrzeit4.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit4, CC.xy(4, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit5 ----
                lblUhrzeit5.setText("donnerstags");
                lblUhrzeit5.setOrientation(1);
                lblUhrzeit5.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit5.setClockwise(false);
                lblUhrzeit5.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit5, CC.xy(5, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit6 ----
                lblUhrzeit6.setText("freitags");
                lblUhrzeit6.setOrientation(1);
                lblUhrzeit6.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit6.setClockwise(false);
                lblUhrzeit6.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit6, CC.xy(6, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit7 ----
                lblUhrzeit7.setText("samstags");
                lblUhrzeit7.setOrientation(1);
                lblUhrzeit7.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit7.setClockwise(false);
                lblUhrzeit7.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit7, CC.xy(7, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit8 ----
                lblUhrzeit8.setText("sonntags");
                lblUhrzeit8.setOrientation(1);
                lblUhrzeit8.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit8.setClockwise(false);
                lblUhrzeit8.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit8, CC.xy(8, 5, CC.CENTER, CC.BOTTOM));

                //---- cbMon ----
                cbMon.setBorder(BorderFactory.createEmptyBorder());
                cbMon.setMargin(new Insets(0, 0, 0, 0));
                cbMon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMon, CC.xy(2, 7, CC.CENTER, CC.DEFAULT));

                //---- cbDie ----
                cbDie.setBorder(BorderFactory.createEmptyBorder());
                cbDie.setMargin(new Insets(0, 0, 0, 0));
                cbDie.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDieActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDie, CC.xy(3, 7, CC.CENTER, CC.DEFAULT));

                //---- cbMit ----
                cbMit.setBorder(BorderFactory.createEmptyBorder());
                cbMit.setMargin(new Insets(0, 0, 0, 0));
                cbMit.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMitActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMit, CC.xy(4, 7, CC.CENTER, CC.DEFAULT));

                //---- cbDon ----
                cbDon.setBorder(BorderFactory.createEmptyBorder());
                cbDon.setMargin(new Insets(0, 0, 0, 0));
                cbDon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDon, CC.xy(5, 7, CC.CENTER, CC.DEFAULT));

                //---- cbFre ----
                cbFre.setBorder(BorderFactory.createEmptyBorder());
                cbFre.setMargin(new Insets(0, 0, 0, 0));
                cbFre.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbFreActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbFre, CC.xy(6, 7, CC.CENTER, CC.DEFAULT));

                //---- cbSam ----
                cbSam.setBorder(BorderFactory.createEmptyBorder());
                cbSam.setMargin(new Insets(0, 0, 0, 0));
                cbSam.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSamActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSam, CC.xy(7, 7, CC.CENTER, CC.DEFAULT));

                //---- cbSon ----
                cbSon.setBorder(BorderFactory.createEmptyBorder());
                cbSon.setMargin(new Insets(0, 0, 0, 0));
                cbSon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSon, CC.xy(8, 7, CC.CENTER, CC.DEFAULT));
            }
            tabWdh.addTab("W\u00f6chentlich", pnlWeekly);

            //======== pnlMonthly ========
            {
                pnlMonthly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.setLayout(
                        new FormLayout("default, $lcgap, pref, $lcgap, 40dlu, $lcgap, pref, $lcgap, 61dlu",
                                "3*(default, $lgap), default"));

                //---- lblEveryMonth ----
                lblEveryMonth.setText("jeden");
                lblEveryMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                lblEveryMonth.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(lblEveryMonth, CC.xy(3, 3));

                //---- spinMonat ----
                spinMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(spinMonat, CC.xy(5, 3));

                //---- lblMonth ----
                lblMonth.setText("Monat");
                lblMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(lblMonth, CC.xy(7, 3));

                //---- btnJedenMonat ----
                btnJedenMonat.setText("Jeden Monat");
                btnJedenMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                btnJedenMonat.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenMonatActionPerformed(e);
                    }
                });
                pnlMonthly.add(btnJedenMonat, CC.xywh(3, 5, 5, 1));

                //---- llblOnDayOfMonth ----
                llblOnDayOfMonth.setText("jeweils am");
                llblOnDayOfMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                llblOnDayOfMonth.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(llblOnDayOfMonth, CC.xy(3, 7));

                //---- spinDayInMonth ----
                spinDayInMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                spinDayInMonth.addChangeListener(new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                        spinMonatTagStateChanged(e);
                    }
                });
                pnlMonthly.add(spinDayInMonth, CC.xy(5, 7));

                //---- cmbTag ----
                cmbTag.setModel(new DefaultComboBoxModel<>(new String[] { "Tag des Monats", "Montag",
                        "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag" }));
                cmbTag.setFont(new Font("Arial", Font.PLAIN, 14));
                cmbTag.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        cmbTagItemStateChanged(e);
                    }
                });
                pnlMonthly.add(cmbTag, CC.xywh(7, 7, 3, 1));
            }
            tabWdh.addTab("Monatlich", pnlMonthly);

            //======== pnlYearly ========
            {
                pnlYearly.setLayout(new FormLayout("30dlu, $rgap, 26dlu, $rgap, pref, $ugap, default",
                        "default, 15dlu, default"));

                //---- lblEveryYear ----
                lblEveryYear.setText("alle");
                lblEveryYear.setFont(new Font("Arial", Font.PLAIN, 14));
                lblEveryYear.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlYearly.add(lblEveryYear, CC.xy(1, 1));

                //---- spinYearly ----
                spinYearly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlYearly.add(spinYearly, CC.xy(3, 1));

                //---- lblYear ----
                lblYear.setText("Jahre");
                lblYear.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlYearly.add(lblYear, CC.xy(5, 1));

                //---- btnEveryYear ----
                btnEveryYear.setText("jedes Jahr");
                btnEveryYear.setFont(new Font("Arial", Font.PLAIN, 14));
                btnEveryYear.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnEveryYearActionPerformed(e);
                    }
                });
                pnlYearly.add(btnEveryYear, CC.xy(7, 1));

                //---- lblOnDay ----
                lblOnDay.setText("alle");
                lblOnDay.setFont(new Font("Arial", Font.PLAIN, 14));
                lblOnDay.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlYearly.add(lblOnDay, CC.xy(1, 3));

                //---- spinDayInMonthInYear ----
                spinDayInMonthInYear.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlYearly.add(spinDayInMonthInYear, CC.xy(3, 3));
                pnlYearly.add(cmbMonth, CC.xywh(5, 3, 3, 1));
            }
            tabWdh.addTab("text", pnlYearly);
        }
        panelMain.add(tabWdh, CC.xywh(3, 11, 3, 1, CC.FILL, CC.FILL));

        //---- lblLDate ----
        lblLDate.setText("text");
        lblLDate.setFont(new Font("Arial", Font.PLAIN, 10));
        lblLDate.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblLDate, CC.xy(5, 13));
        panelMain.add(jdcStartingOn, CC.xywh(3, 15, 3, 1));

        //======== jScrollPane1 ========
        {

            //---- txtBemerkung ----
            txtBemerkung.setColumns(20);
            txtBemerkung.setRows(5);
            txtBemerkung.setFont(new Font("Arial", Font.PLAIN, 14));
            txtBemerkung.setLineWrap(true);
            txtBemerkung.setWrapStyleWord(true);
            jScrollPane1.setViewportView(txtBemerkung);
        }
        panelMain.add(jScrollPane1, CC.xywh(3, 17, 3, 1, CC.DEFAULT, CC.FILL));

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSaveActionPerformed(e);
            }
        });
        panelMain.add(btnSave, CC.xy(5, 19, CC.RIGHT, CC.DEFAULT));

        //---- lblDueDays ----
        lblDueDays.setText("text");
        lblDueDays.setFont(new Font("Arial", Font.PLAIN, 10));
        lblDueDays.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblDueDays, CC.xy(3, 5));

        //---- txtDueDays ----
        txtDueDays.setFont(new Font("Arial", Font.PLAIN, 14));
        panelMain.add(txtDueDays, CC.xy(3, 7, CC.DEFAULT, CC.FILL));
    }
    add(panelMain, BorderLayout.CENTER);

    //---- buttonGroup1 ----
    ButtonGroup buttonGroup1 = new ButtonGroup();
    buttonGroup1.add(cbMon);
    buttonGroup1.add(cbDie);
    buttonGroup1.add(cbMit);
    buttonGroup1.add(cbDon);
    buttonGroup1.add(cbFre);
    buttonGroup1.add(cbSam);
    buttonGroup1.add(cbSon);
}

From source file:fll.scheduler.SchedulerUI.java

/**
 * Run the scheduler and optionally the table optimizer.
 *//* www  . j a  va 2 s.c  om*/
private void runScheduler() {
    try {
        saveScheduleDescription();

        final SchedulerWorker worker = new SchedulerWorker();

        // make sure the task doesn't start until the window is up
        _progressDialog.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentShown(final ComponentEvent e) {
                _progressDialog.removeComponentListener(this);
                worker.execute();
            }
        });

        _progressDialog.setLocationRelativeTo(SchedulerUI.this);
        _progressDialog.setNote("Running Scheduler");
        _progressDialog.setVisible(true);

    } catch (final IOException e) {
        final Formatter errorFormatter = new Formatter();
        errorFormatter.format("Error reading description file: %s", e.getMessage());
        LOGGER.error(errorFormatter, e);
        JOptionPane.showMessageDialog(SchedulerUI.this, errorFormatter, "Error Running Scheduler",
                JOptionPane.ERROR_MESSAGE);
    } catch (final ParseException e) {
        final Formatter errorFormatter = new Formatter();
        errorFormatter.format("Error parsing description file: %s", e.getMessage());
        LOGGER.error(errorFormatter, e);
        JOptionPane.showMessageDialog(SchedulerUI.this, errorFormatter, "Error Running Scheduler",
                JOptionPane.ERROR_MESSAGE);
    } catch (final InvalidParametersException e) {
        LOGGER.error(e.getMessage(), e);
        JOptionPane.showMessageDialog(SchedulerUI.this, e.getMessage(), "Error Running Scheduler",
                JOptionPane.ERROR_MESSAGE);
    }

}

From source file:net.java.sip.communicator.impl.gui.main.chat.ChatConversationPanel.java

/**
 * Creates an instance of <tt>ChatConversationPanel</tt>.
 *
 * @param chatContainer The parent <tt>ChatConversationContainer</tt>.
 *//*  w ww  . j  a va  2  s.  co m*/
public ChatConversationPanel(ChatConversationContainer chatContainer) {
    editorKit = new ChatConversationEditorKit(this);

    this.chatContainer = chatContainer;

    isHistory = (chatContainer instanceof HistoryWindow);

    this.rightButtonMenu = new ChatRightButtonMenu(this);

    this.document = (HTMLDocument) editorKit.createDefaultDocument();

    this.document.addDocumentListener(editorKit);

    this.chatTextPane.setEditorKitForContentType("text/html", editorKit);
    this.chatTextPane.setEditorKit(editorKit);
    this.chatTextPane.setEditable(false);
    this.chatTextPane.setDocument(document);
    this.chatTextPane.setDragEnabled(true);

    chatTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
    Constants.loadSimpleStyle(document.getStyleSheet(), chatTextPane.getFont());

    this.chatTextPane.addHyperlinkListener(this);
    this.chatTextPane.addMouseListener(this);
    this.chatTextPane.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));

    this.addChatLinkClickedListener(showPreview);

    this.setWheelScrollingEnabled(true);

    this.setViewportView(chatTextPane);

    this.setBorder(null);

    this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    ToolTipManager.sharedInstance().registerComponent(chatTextPane);

    String copyLinkString = GuiActivator.getResources().getI18NString("service.gui.COPY_LINK");

    copyLinkItem = new JMenuItem(copyLinkString, new ImageIcon(ImageLoader.getImage(ImageLoader.COPY_ICON)));

    copyLinkItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            StringSelection stringSelection = new StringSelection(currentHref);
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            clipboard.setContents(stringSelection, ChatConversationPanel.this);
        }
    });

    String openLinkString = GuiActivator.getResources().getI18NString("service.gui.OPEN_IN_BROWSER");

    openLinkItem = new JMenuItem(openLinkString, new ImageIcon(ImageLoader.getImage(ImageLoader.BROWSER_ICON)));

    openLinkItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            GuiActivator.getBrowserLauncher().openURL(currentHref);

            // after opening the link remove the currentHref to avoid
            // clicking on the window to gain focus to open the link again
            ChatConversationPanel.this.currentHref = "";
        }
    });

    openLinkItem.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.OPEN_IN_BROWSER"));

    copyLinkItem.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.COPY_LINK"));

    configureReplacementItem = new JMenuItem(
            GuiActivator.getResources().getI18NString("plugin.chatconfig.replacement.CONFIGURE_REPLACEMENT"),
            GuiActivator.getResources().getImage("service.gui.icons.CONFIGURE_ICON"));

    configureReplacementItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            final ConfigurationContainer configContainer = GuiActivator.getUIService()
                    .getConfigurationContainer();

            ConfigurationForm chatConfigForm = getChatConfigForm();

            if (chatConfigForm != null) {
                configContainer.setSelected(chatConfigForm);

                configContainer.setVisible(true);
            }
        }
    });

    this.isSimpleTheme = ConfigurationUtils.isChatSimpleThemeEnabled();

    /*
     * When we append a new message (regardless of whether it is a string or
     * an UI component), we want to make it visible in the viewport of this
     * JScrollPane so that the user can see it.
     */
    ComponentListener componentListener = new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            synchronized (scrollToBottomRunnable) {
                if (!scrollToBottomIsPending)
                    return;
                scrollToBottomIsPending = false;

                /*
                 * Yana Stamcheva, pointed out that Java 5 (on Linux only?)
                 * needs invokeLater for JScrollBar.
                 */
                SwingUtilities.invokeLater(scrollToBottomRunnable);
            }
        }
    };

    chatTextPane.addComponentListener(componentListener);
    getViewport().addComponentListener(componentListener);
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractTable.java

protected void initComponent() {
    layout = new MigLayout("flowy, fill, insets 0", "", "[min!][fill]");
    panel = new JPanel(layout);

    topPanel = new JPanel(new BorderLayout());
    topPanel.setVisible(false);/*  w w  w.  j  a va  2 s  .c o  m*/
    panel.add(topPanel, "growx");

    scrollPane = new JScrollPane(impl);
    impl.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    impl.setFillsViewportHeight(true);
    panel.add(scrollPane, "grow");

    impl.setShowGrid(true);
    impl.setGridColor(Color.lightGray);

    impl.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
                handleClickAction();
            }
        }

        @Override
        public void mousePressed(MouseEvent e) {
            showPopup(e);
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            showPopup(e);
        }

        protected void showPopup(MouseEvent e) {
            if (e.isPopupTrigger() && contextMenuEnabled) {
                // select row
                Point p = e.getPoint();
                int viewRowIndex = impl.rowAtPoint(p);

                int rowNumber;
                if (viewRowIndex >= 0) {
                    rowNumber = impl.convertRowIndexToModel(viewRowIndex);
                } else {
                    rowNumber = -1;
                }
                ListSelectionModel model = impl.getSelectionModel();

                if (!model.isSelectedIndex(rowNumber)) {
                    model.setSelectionInterval(rowNumber, rowNumber);
                }

                // show popup menu
                JPopupMenu popupMenu = createPopupMenu();
                if (popupMenu.getComponentCount() > 0) {
                    popupMenu.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        }
    });

    ColumnControlButton columnControlButton = new ColumnControlButton(impl) {
        @Override
        protected ColumnVisibilityAction createColumnVisibilityAction(TableColumn column) {
            ColumnVisibilityAction columnVisibilityAction = super.createColumnVisibilityAction(column);

            columnVisibilityAction.addPropertyChangeListener(evt -> {
                if ("SwingSelectedKey".equals(evt.getPropertyName()) && evt.getNewValue() instanceof Boolean) {
                    ColumnVisibilityAction action = (ColumnVisibilityAction) evt.getSource();

                    String columnName = action.getActionCommand();
                    boolean collapsed = !((boolean) evt.getNewValue());

                    Column col = getColumn(columnName);
                    if (col != null) {
                        col.setCollapsed(collapsed);
                    }
                }
            });

            return columnVisibilityAction;
        }
    };
    impl.setColumnControl(columnControlButton);

    impl.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
    impl.getActionMap().put("enter", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (enterPressAction != null) {
                enterPressAction.actionPerform(DesktopAbstractTable.this);
            } else {
                handleClickAction();
            }
        }
    });

    Messages messages = AppBeans.get(Messages.NAME);
    // localize default column control actions
    for (Object actionKey : impl.getActionMap().allKeys()) {
        if ("column.packAll".equals(actionKey)) {
            BoundAction action = (BoundAction) impl.getActionMap().get(actionKey);
            action.setName(messages.getMessage(DesktopTable.class, "DesktopTable.packAll"));
        } else if ("column.packSelected".equals(actionKey)) {
            BoundAction action = (BoundAction) impl.getActionMap().get(actionKey);
            action.setName(messages.getMessage(DesktopTable.class, "DesktopTable.packSelected"));
        } else if ("column.horizontalScroll".equals(actionKey)) {
            BoundAction action = (BoundAction) impl.getActionMap().get(actionKey);
            action.setName(messages.getMessage(DesktopTable.class, "DesktopTable.horizontalScroll"));
        }
    }

    // Ability to configure fonts in table
    // Add action to column control
    String configureFontsLabel = messages.getMessage(DesktopTable.class, "DesktopTable.configureFontsLabel");
    impl.getActionMap().put(ColumnControlButton.COLUMN_CONTROL_MARKER + "fonts",
            new AbstractAction(configureFontsLabel) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Component rootComponent = SwingUtilities.getRoot(impl);
                    final FontDialog fontDialog = FontDialog.show(rootComponent, impl.getFont());
                    fontDialog.addWindowListener(new WindowAdapter() {
                        @Override
                        public void windowClosed(WindowEvent e) {
                            Font result = fontDialog.getResult();
                            if (result != null) {
                                impl.setFont(result);
                                packRows();
                            }
                        }
                    });
                    fontDialog.open();
                }
            });

    // Ability to reset settings
    String resetSettingsLabel = messages.getMessage(DesktopTable.class, "DesktopTable.resetSettings");
    impl.getActionMap().put(ColumnControlButton.COLUMN_CONTROL_MARKER + "resetSettings",
            new AbstractAction(resetSettingsLabel) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    resetPresentation();
                }
            });

    scrollPane.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            if (!columnsInitialized) {
                adjustColumnHeaders();
            }
            columnsInitialized = true;
        }
    });

    // init default row height
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (!fontInitialized) {
                applyFont(impl, impl.getFont());
            }
        }
    });
}

From source file:de.xplib.xdbm.ui.Application.java

/**
 * /*from  w w  w  .j a v  a2 s .  c  o m*/
 */
private void initListener() {

    this.addWindowListener(new WindowAdapter() {
        public void windowClosing(final WindowEvent we) {
            config.save();
            if (xmldb != null) {
                try {
                    xmldb.getCollection("/db", "sa", "").close();
                } catch (XMLDBException e) {
                    e.printStackTrace();
                }
            }
        }
    });
    this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    this.jspContentConsole.addComponentListener(new ComponentAdapter() {

        public void componentResized(final ComponentEvent ce) {
            jspContentConsole.setDividerLocation(jspContentConsole.getHeight() - 150);
        }
    });
}

From source file:de.mprengemann.intellij.plugin.androidicons.forms.AndroidBatchScaleImporter.java

private void initColumnSizes() {
    table.addComponentListener(new ComponentAdapter() {
        @Override//from  ww w  .j  ava  2  s . c  o m
        public void componentResized(ComponentEvent componentEvent) {
            super.componentResized(componentEvent);
            Dimension tableSize = table.getSize();
            final int[] columnSizes = new int[] { 20, 10, 10, 10, 10, 20, 20 };
            for (int i = 0; i < table.getColumnCount(); i++) {
                TableColumn column = table.getColumnModel().getColumn(i);
                column.setPreferredWidth((int) (tableSize.width * (columnSizes[i] / 100f)));
            }
        }
    });
}

From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.JPanCodeMatchMain.java

/**
 * This method initializes jPanel   /*  w w  w  . j  av a2s  . co m*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanelBottom == null) {
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridx = 0;
        gridBagConstraints11.anchor = GridBagConstraints.WEST;
        gridBagConstraints11.gridy = 2;
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.gridx = 0;
        gridBagConstraints5.anchor = GridBagConstraints.WEST;
        gridBagConstraints5.insets = new Insets(0, 30, 0, 0);
        gridBagConstraints5.gridy = 3;
        GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
        gridBagConstraints9.fill = GridBagConstraints.BOTH;
        gridBagConstraints9.gridx = 0;
        gridBagConstraints9.gridy = 0;
        gridBagConstraints9.weightx = 1.0;
        gridBagConstraints9.weighty = 1.0;
        gridBagConstraints9.gridwidth = 1;
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.gridx = 0;
        gridBagConstraints4.anchor = GridBagConstraints.WEST;
        gridBagConstraints4.insets = new Insets(0, 0, 3, 0);
        gridBagConstraints4.gridwidth = 1;
        gridBagConstraints4.gridy = 5;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.anchor = GridBagConstraints.WEST;
        gridBagConstraints2.insets = new Insets(3, 0, 0, 0);
        gridBagConstraints2.gridwidth = 1;
        gridBagConstraints2.gridy = 1;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.anchor = GridBagConstraints.WEST;
        gridBagConstraints1.gridwidth = 1;
        gridBagConstraints1.gridy = 4;
        jPanelBottom = new JPanel();
        jPanelBottom.setLayout(new GridBagLayout());
        jPanelBottom.add(getJRadioButtonOpt3(), gridBagConstraints1);
        jPanelBottom.add(getJRadioButtonOpt1(), gridBagConstraints2);
        jPanelBottom.add(getJRadioButtonOpt4(), gridBagConstraints4);
        jPanelBottom.add(getJPanelTableForCardLayout(), gridBagConstraints9);
        jPanelBottom.add(getJPanelFolder(), gridBagConstraints5);
        jPanelBottom.add(getJPanelFolderTitle(), gridBagConstraints11);

        this.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent e) {
                log.debug("code match source code divider resized...");
                jSplitPaneSourceCode.setDividerLocation(jSplitPaneSourceCode.getSize().width / 2);
            }
        });

    }
    return jPanelBottom;
}

From source file:it.unibas.spicygui.vista.JLayeredPaneCorrespondences.java

private void initListenerSplit() {
    this.getSplit().addComponentListener(new ComponentAdapter() {

        @Override//from  w  w w. j av  a  2s  . com
        public void componentResized(ComponentEvent e) {
            moveToFront();
            glassPane.updateUI();
        }

        @Override
        public void componentMoved(ComponentEvent e) {
            moveToFront();
            glassPane.updateUI();
        }
    });

    this.getSplitChild().addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            moveToFront();
            glassPane.updateUI();
        }

        @Override
        public void componentMoved(ComponentEvent e) {
            moveToFront();
            glassPane.updateUI();
        }
    });
}