List of usage examples for javax.swing SpinnerNumberModel SpinnerNumberModel
public SpinnerNumberModel(double value, double minimum, double maximum, double stepSize)
SpinnerNumberModel
with the specified value
, minimum
/maximum
bounds, and stepSize
. From source file:org.fhaes.jsea.JSEAFrame.java
/** * Setup the GUI components/*from w ww . j av a 2 s. c om*/ */ private void setupGui() { setTitle("jSEA - Superposed Epoch Analysis"); getContentPane().setLayout(new MigLayout("", "[1200px,grow,fill]", "[][600px,grow,fill]")); initActions(); setupMenu(); setupToolbar(); this.setIconImage(Builder.getApplicationIcon()); { JSplitPane splitPane = new JSplitPane(); splitPane.setOneTouchExpandable(true); getContentPane().add(splitPane, "cell 0 1,alignx left,aligny top"); splitPane.setLeftComponent(contentPanel); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPanel.setLayout(new MigLayout("", "[grow,fill]", "[78.00][][][grow][]")); { JPanel panel = new JPanel(); panel.setBorder( new TitledBorder(null, "Input Files", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 0,grow"); panel.setLayout(new MigLayout("", "[][][grow][]", "[][]")); { JLabel lblContinuousTimeSeries = new JLabel("Continuous time series file:"); panel.add(lblContinuousTimeSeries, "cell 0 0,alignx trailing"); } { HelpTipButton label = new HelpTipButton( "Continuous time series data files should be two column comma seperated (CSV) text files. Column one should contains the years (in sequence), and column two should contain the data values. If there are header lines or comments in the file, these lines should beginning with a *"); panel.add(label, "cell 1 0,alignx trailing"); } { txtTimeSeriesFile = new JTextField(); txtwrapper = new TextComponentWrapper(txtTimeSeriesFile, PrefKey.JSEA_CONTINUOUS_TIME_SERIES_FILE, ""); txtTimeSeriesFile.setEditable(true); panel.add(txtTimeSeriesFile, "cell 2 0,growx"); txtTimeSeriesFile.setColumns(10); } { btnTimeSeriesFile = new JButton(); btnTimeSeriesFile.setIcon(Builder.getImageIcon("fileopen16.png")); btnTimeSeriesFile.setActionCommand("TimeSeriesFileBrowse"); btnTimeSeriesFile.addActionListener(this); btnTimeSeriesFile.setPreferredSize(new Dimension(25, 25)); btnTimeSeriesFile.setMaximumSize(new Dimension(25, 25)); btnTimeSeriesFile.putClientProperty("JButton.buttonType", "segmentedTextured"); btnTimeSeriesFile.putClientProperty("JButton.segmentPosition", "middle"); panel.add(btnTimeSeriesFile, "cell 3 0"); } { JLabel lblEventListFile = new JLabel("Event list file:"); panel.add(lblEventListFile, "cell 0 1,alignx trailing"); } { HelpTipButton helpTipButton = new HelpTipButton( "Event data files should be a text file with a single column of integer year values. If there are any header or comment lines, these should begin with a *"); panel.add(helpTipButton, "cell 1 1,alignx trailing"); } { txtEventListFile = new JTextField(); new TextComponentWrapper(txtEventListFile, PrefKey.JSEA_EVENT_LIST_FILE, ""); txtEventListFile.setEditable(false); panel.add(txtEventListFile, "cell 2 1,growx"); txtEventListFile.setColumns(10); } { btnEventListFile = new JButton(); btnEventListFile.setIcon(Builder.getImageIcon("fileopen16.png")); btnEventListFile.setActionCommand("EventListFileBrowse"); btnEventListFile.addActionListener(this); btnEventListFile.setPreferredSize(new Dimension(25, 25)); btnEventListFile.setMaximumSize(new Dimension(25, 25)); btnEventListFile.putClientProperty("JButton.buttonType", "segmentedTextured"); btnEventListFile.putClientProperty("JButton.segmentPosition", "middle"); panel.add(btnEventListFile, "cell 3 1"); } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Window, Simulation and Statistics", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 1,grow"); panel.setLayout(new MigLayout("", "[right][][fill][10px:10px:10px][right][][90.00,grow,fill]", "[grow][][][]")); { JLabel lblYears = new JLabel("Years to analyse:"); panel.add(lblYears, "cell 0 0"); } { HelpTipButton helpTipButton = new HelpTipButton( "Specify which years from the dataset to analyse."); panel.add(helpTipButton, "cell 1 0"); } { JPanel panel_1 = new JPanel(); panel.add(panel_1, "cell 2 0 5 1,grow"); panel_1.setLayout(new MigLayout("fill, insets 0", "[80px:80px][][80px:80px,fill][grow]", "[]")); { spnFirstYear = new JSpinner(); spnFirstYear.setEnabled(false); panel_1.add(spnFirstYear, "cell 0 0,growx"); spnFirstYear.setModel(new SpinnerNumberModel(new Integer(0), null, null, new Integer(1))); spnFirstYear.setEditor(new JSpinner.NumberEditor(spnFirstYear, "#")); new SpinnerWrapper(spnFirstYear, PrefKey.JSEA_FIRST_YEAR, 0); } { JLabel lblTo = new JLabel("-"); panel_1.add(lblTo, "cell 1 0"); } { spnLastYear = new JSpinner(); spnLastYear.setEnabled(false); panel_1.add(spnLastYear, "cell 2 0"); spnLastYear.setModel(new SpinnerNumberModel(new Integer(2020), null, null, new Integer(1))); spnLastYear.setEditor(new JSpinner.NumberEditor(spnLastYear, "#")); new SpinnerWrapper(spnLastYear, PrefKey.JSEA_LAST_YEAR, 2020); } { chkAllYears = new JCheckBox("all years in series"); chkAllYears.setSelected(true); chkAllYears.setActionCommand("AllYearsCheckbox"); chkAllYears.addActionListener(this); panel_1.add(chkAllYears, "cell 3 0"); } } { JLabel lblLagsPriorTo = new JLabel("Lags prior to event:"); panel.add(lblLagsPriorTo, "cell 0 1"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 1"); } { spnLagsPrior = new JSpinner(); new SpinnerWrapper(spnLagsPrior, PrefKey.JSEA_LAGS_PRIOR_TO_EVENT, 6); panel.add(spnLagsPrior, "cell 2 1,growx"); // spnLagsPrior.setModel(new SpinnerNumberModel(6, 1, 100, 1)); spnLagsPrior.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { segmentationPanel.table.tableModel.clearSegments(); validateForm(); } }); } { JLabel lblSimulationsToRun = new JLabel("Simulations:"); panel.add(lblSimulationsToRun, "cell 4 1"); } { HelpTipButton helpTipButton = new HelpTipButton( "Number of simulations to run. Increasing the number of simulations increases the analysis time."); panel.add(helpTipButton, "cell 5 1"); } { spnSimulationsToRun = new JSpinner(); new SpinnerWrapper(spnSimulationsToRun, PrefKey.JSEA_SIMULATION_COUNT, 1000); panel.add(spnSimulationsToRun, "cell 6 1"); spnSimulationsToRun.setModel(new SpinnerNumberModel(1000, 1, 10096, 1)); } { JLabel lblLagsFollowingThe = new JLabel("Lags following the event:"); panel.add(lblLagsFollowingThe, "cell 0 2"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 2"); } { spnLagsAfter = new JSpinner(); new SpinnerWrapper(spnLagsAfter, PrefKey.JSEA_LAGS_AFTER_EVENT, 4); panel.add(spnLagsAfter, "cell 2 2,growx"); spnLagsAfter.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { segmentationPanel.table.tableModel.clearSegments(); validateForm(); } }); } { JLabel lblSeedNumber = new JLabel("Seed number:"); panel.add(lblSeedNumber, "cell 4 2"); } { HelpTipButton helpTipButton = new HelpTipButton( "The analysis requires a pseudo-random component which is seeded with the seed number (a large integer value). Running analyses with the same seed number enables produces the same results. You can leave the seed as the default number unless you specifically want to generate results from a different randomised pool."); panel.add(helpTipButton, "cell 5 2"); } { spnSeedNumber = new JSpinner(); new SpinnerWrapper(spnSeedNumber, PrefKey.JSEA_SEED_NUMBER, 30188); panel.add(spnSeedNumber, "cell 6 2"); spnSeedNumber.setModel(new SpinnerNumberModel(30188, 10000, 1000000, 1)); } { JLabel lblIncludeIncompleteWindow = new JLabel("Include incomplete epoch:"); panel.add(lblIncludeIncompleteWindow, "cell 0 3"); } { HelpTipButton helpTipButton = new HelpTipButton(""); panel.add(helpTipButton, "cell 1 3"); } { chkIncludeIncompleteWindow = new JCheckBox(""); new CheckBoxWrapper(chkIncludeIncompleteWindow, PrefKey.JSEA_INCLUDE_INCOMPLETE_WINDOW, false); panel.add(chkIncludeIncompleteWindow, "cell 2 3"); } { JLabel lblPvalue = new JLabel("p-value:"); panel.add(lblPvalue, "cell 4 3"); } { HelpTipButton helpTipButton = new HelpTipButton( "The cutoff value to use for statistical significance"); panel.add(helpTipButton, "cell 5 3,alignx trailing"); } { cbxPValue = new JComboBox(); panel.add(cbxPValue, "cell 6 3"); cbxPValue.setModel(new DefaultComboBoxModel(new Double[] { 0.05, 0.01, 0.001 })); } } { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(null, "Chart Options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); contentPanel.add(panel, "cell 0 2,grow"); panel.setLayout(new MigLayout("", "[right][][grow]", "[][]")); { JLabel lblTitleOfChart = new JLabel("Title of chart:"); panel.add(lblTitleOfChart, "cell 0 0,alignx trailing"); } { HelpTipButton helpTipButton = new HelpTipButton( "Title to use on the chart. The placeholder {segment} is replaced with the years of the segment being plotted."); panel.add(helpTipButton, "cell 1 0,alignx trailing"); } { txtChartTitle = new JTextField(); txtChartTitle.setToolTipText("<html>Title to be displayed on the<br/>" + "chart output"); new TextComponentWrapper(txtChartTitle, PrefKey.JSEA_CHART_TITLE, "Chart title {segment}"); panel.add(txtChartTitle, "cell 2 0,growx,aligny top"); txtChartTitle.setColumns(10); } { JLabel lblYaxisLabel = new JLabel("Continuous series (y-axis) label"); panel.add(lblYaxisLabel, "cell 0 1,alignx trailing"); } { txtYAxisLabel = new JTextField(); txtYAxisLabel .setToolTipText("<html>Label to be displayed on the<br/> " + "continuous series axis"); new TextComponentWrapper(txtYAxisLabel, PrefKey.JSEA_YAXIS_LABEL, "Y Axis"); panel.add(txtYAxisLabel, "cell 2 1,growx"); txtYAxisLabel.setColumns(10); } } { // Segmentation implementation used from FHSampleSize segmentationPanel = new SegmentationPanel(); segmentationPanel.chkSegmentation.setText("Process subset or segments of events?"); segmentationPanel.chkSegmentation.setActionCommand("SegmentationMode"); segmentationPanel.chkSegmentation.addActionListener(this); contentPanel.add(segmentationPanel, "cell 0 3,grow"); } { tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM); splitPane.setRightComponent(tabbedPane); { summaryPanel = new JPanel(); tabbedPane.addTab("Summary ", Builder.getImageIcon("info.png"), summaryPanel, null); summaryPanel.setLayout(new BorderLayout(0, 0)); { scrollPane = new JScrollPane(); summaryPanel.add(scrollPane); { txtSummary = new JTextArea(); txtSummary.setEditable(false); scrollPane.setViewportView(txtSummary); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(scrollPane, popup); popup.add(mntmCopy); } } } { dataPanel = new JPanel(); tabbedPane.addTab("Data ", Builder.getImageIcon("table.png"), dataPanel, null); dataPanel.setLayout(new MigLayout("", "[grow,fill]", "[grow]")); { JSplitPane splitPaneDataTables = new JSplitPane(); splitPaneDataTables.setResizeWeight(0.5); splitPaneDataTables.setOneTouchExpandable(true); splitPaneDataTables.setOrientation(JSplitPane.VERTICAL_SPLIT); dataPanel.add(splitPaneDataTables, "cell 0 0,grow"); { JPanel panel = new JPanel(); splitPaneDataTables.setLeftComponent(panel); panel.setBorder(new TitledBorder(null, "Actual key events", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setLayout(new MigLayout("", "[227.00px,grow,fill]", "[68.00px,grow,fill]")); { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 0,grow"); { tblActual = new JXTable(); adapterActualTable = new JTableSpreadsheetByRowAdapter(tblActual); scrollPane.setViewportView(tblActual); tblActual.setSortable(false); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(tblActual, popup); popup.add(mntmCopy); } } } { JPanel panel = new JPanel(); splitPaneDataTables.setRightComponent(panel); panel.setBorder(new TitledBorder(null, "Simulation results", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setLayout(new MigLayout("", "[grow,fill]", "[grow,fill]")); { JScrollPane scrollPane = new JScrollPane(); panel.add(scrollPane, "cell 0 0,grow"); { tblSimulation = new JXTable(); adapterSimulationTable = new JTableSpreadsheetByRowAdapter(tblSimulation); scrollPane.setViewportView(tblSimulation); tblSimulation.setSortable(false); JMenuItem mntmCopy = new JMenuItem(actionCopy); JPopupMenu popup = new JPopupMenu(); addPopup(tblSimulation, popup); popup.add(mntmCopy); } } } splitPaneDataTables.setDividerLocation(0.5f); } } { chartPanel = new JPanel(); tabbedPane.addTab("Chart ", Builder.getImageIcon("barchart.png"), chartPanel, null); chartPanel.setLayout(new MigLayout("", "[][grow]", "[][grow]")); { segmentComboBox = new JComboBox(); segmentComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent arg0) { if (segmentComboBox.getItemCount() > 0) { barChart = new JSEABarChart( jsea.getChartList().get(segmentComboBox.getSelectedIndex())); barChart.setMaximumDrawHeight(MAX_DRAW_HEIGHT); barChart.setMaximumDrawWidth(MAX_DRAW_WIDTH); chartPanel.removeAll(); chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center"); chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center"); chartPanel.add(barChart, "cell 0 1 2 1,grow"); chartPanel.revalidate(); chartPanel.repaint(); } } }); { plotSegmentLabel = new JLabel("Plot Segment: "); chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center"); } chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center"); } } } } pack(); validateForm(); setAnalysisAvailable(false); setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); }
From source file:de.bfs.radon.omsimulation.gui.OMPanelSimulation.java
/** * Initialises the interface of the simulation panel. *//*from ww w . java2 s . c o m*/ protected void initialize() { setLayout(null); btnStart = new JButton("Start"); btnStart.addActionListener(this); btnStart.setBounds(616, 326, 124, 23); btnStart.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(btnStart); progressBarSimulation = new JProgressBar(); progressBarSimulation.setBounds(10, 475, 730, 23); progressBarSimulation.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); progressBarSimulation.setVisible(false); add(progressBarSimulation); lblSelectOmbfile = new JLabel("Open OMB-File"); lblSelectOmbfile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); lblSelectOmbfile.setBounds(10, 36, 132, 14); add(lblSelectOmbfile); lblOmsFile = new JLabel("Save OMS-File"); lblOmsFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); lblOmsFile.setBounds(174, 272, 120, 14); add(lblOmsFile); txtOmsFile = new JTextField(); txtOmsFile.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { setOmsFile(txtOmsFile.getText()); } }); txtOmsFile.setBounds(304, 269, 302, 20); txtOmsFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(txtOmsFile); txtOmsFile.setColumns(10); btnBrowseOms = new JButton("Browse"); btnBrowseOms.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser fileDialog = new JFileChooser(); fileDialog.setFileFilter(new FileNameExtensionFilter("*.oms", "oms")); fileDialog.showSaveDialog(getParent()); final File file = fileDialog.getSelectedFile(); if (file != null) { String oms; String[] tmpFileName = file.getAbsolutePath().split("\\."); if (tmpFileName[tmpFileName.length - 1].equals("oms")) { oms = ""; } else { oms = ".oms"; } txtOmsFile.setText(file.getAbsolutePath() + oms); setOmsFile(file.getAbsolutePath() + oms); } } }); btnBrowseOms.setBounds(616, 268, 124, 23); btnBrowseOms.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(btnBrowseOms); lblWarning = new JLabel("This could take a while, grab a coffee!"); lblWarning.setBounds(421, 94, 319, 15); lblWarning.setForeground(new Color(255, 0, 0, 255)); lblWarning.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(lblWarning); lblSelectProject = new JLabel("Select Project"); lblSelectProject.setBounds(10, 65, 132, 14); lblSelectProject.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(lblSelectProject); lblSimulationType = new JLabel("Simulation Type"); lblSimulationType.setBounds(10, 94, 132, 14); lblSimulationType.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(lblSimulationType); lblCampaigns = new JLabel("campaigns"); lblCampaigns.setBounds(421, 122, 185, 14); lblCampaigns.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(lblCampaigns); lblRatio = new JLabel("Ratio"); lblRatio.setBounds(174, 152, 44, 14); lblRatio.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(lblRatio); lblPercent = new JLabel("%"); lblPercent.setBounds(246, 302, 360, 14); lblPercent.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(lblPercent); spnrRandomCampaigns = new JSpinner(); spnrRandomCampaigns.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setRandomCampaigns((Integer) spnrRandomCampaigns.getValue()); } }); spnrRandomCampaigns.setModel(new SpinnerNumberModel(10000, 10, 100000, 1)); spnrRandomCampaigns.setBounds(304, 119, 107, 22); spnrRandomCampaigns.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(spnrRandomCampaigns); spnrRatio3 = new JSpinner(); spnrRatio3.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (chckbxRatio3.isSelected()) { setRatio3((Integer) spnrRatio3.getValue()); } else { setRatio3(0); spnrRatio3.setEnabled(false); } } }); spnrRatio3.setModel(new SpinnerNumberModel(2, 0, 10000, 1)); spnrRatio3.setBounds(330, 149, 81, 22); spnrRatio3.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(spnrRatio3); spnrRatio4 = new JSpinner(); spnrRatio4.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (chckbxRatio4.isSelected()) { setRatio4((Integer) spnrRatio4.getValue()); } else { setRatio4(0); spnrRatio4.setEnabled(false); } } }); spnrRatio4.setModel(new SpinnerNumberModel(5, 0, 10000, 1)); spnrRatio4.setBounds(330, 179, 81, 22); spnrRatio4.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(spnrRatio4); spnrRatio5 = new JSpinner(); spnrRatio5.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (chckbxRatio5.isSelected()) { setRatio5((Integer) spnrRatio5.getValue()); } else { setRatio5(0); spnrRatio5.setEnabled(false); } } }); spnrRatio5.setModel(new SpinnerNumberModel(20, 0, 10000, 1)); spnrRatio5.setBounds(330, 209, 81, 22); spnrRatio5.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(spnrRatio5); spnrRatio6 = new JSpinner(); spnrRatio6.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (chckbxRatio6.isSelected()) { setRatio6((Integer) spnrRatio6.getValue()); } else { setRatio6(0); spnrRatio6.setEnabled(false); } } }); spnrRatio6.setModel(new SpinnerNumberModel(73, 0, 10000, 1)); spnrRatio6.setBounds(330, 239, 81, 22); spnrRatio6.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(spnrRatio6); spnrRandomNoise = new JSpinner(); spnrRandomNoise.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { if (chckbxRandomNoise.isSelected()) { setRandomNoise((Integer) spnrRandomNoise.getValue()); } else { setRandomNoise(0); spnrRandomNoise.setEnabled(false); } } }); spnrRandomNoise.setModel(new SpinnerNumberModel(5, 0, 20, 1)); spnrRandomNoise.setBounds(153, 299, 83, 22); spnrRandomNoise.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(spnrRandomNoise); chckbxRatio3 = new JCheckBox("3 of 6"); chckbxRatio3.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (chckbxRatio3.isSelected()) { if (rdbtnRandom.isSelected()) { spnrRatio3.setEnabled(true); } } else { setRatio3(0); spnrRatio3.setEnabled(false); } } }); chckbxRatio3.setBounds(237, 149, 80, 23); chckbxRatio3.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(chckbxRatio3); chckbxRatio4 = new JCheckBox("4 of 6"); chckbxRatio4.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (chckbxRatio4.isSelected()) { if (rdbtnRandom.isSelected()) { spnrRatio4.setEnabled(true); } } else { setRatio4(0); spnrRatio4.setEnabled(false); } } }); chckbxRatio4.setBounds(237, 179, 80, 23); chckbxRatio4.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(chckbxRatio4); chckbxRatio5 = new JCheckBox("5 of 6"); chckbxRatio5.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (chckbxRatio5.isSelected()) { if (rdbtnRandom.isSelected()) { spnrRatio5.setEnabled(true); } } else { setRatio5(0); spnrRatio5.setEnabled(false); } } }); chckbxRatio5.setBounds(237, 209, 80, 23); chckbxRatio5.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(chckbxRatio5); chckbxRatio6 = new JCheckBox("6 of 6"); chckbxRatio6.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (chckbxRatio6.isSelected()) { if (rdbtnRandom.isSelected()) { spnrRatio6.setEnabled(true); } } else { setRatio6(0); spnrRatio6.setEnabled(false); } } }); chckbxRatio6.setBounds(237, 239, 80, 23); chckbxRatio6.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(chckbxRatio6); chckbxRandomNoise = new JCheckBox("Random noise"); chckbxRandomNoise.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (chckbxRandomNoise.isSelected()) { if (chckbxRandomNoise.isEnabled()) { spnrRandomNoise.setEnabled(true); } } else { setRandomNoise(0); spnrRandomNoise.setEnabled(false); } } }); chckbxRandomNoise.setBounds(10, 299, 137, 23); chckbxRandomNoise.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(chckbxRandomNoise); btnRefresh = new JButton("Load"); btnRefresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (txtOmbFile.getText() != null && !txtOmbFile.getText().equals("") && !txtOmbFile.getText().equals(" ")) { txtOmbFile.setBackground(Color.WHITE); String ombPath = txtOmbFile.getText(); String omb; String[] tmpFileName = ombPath.split("\\."); if (tmpFileName[tmpFileName.length - 1].equals("omb")) { omb = ""; } else { omb = ".omb"; } txtOmbFile.setText(ombPath + omb); setOmbFile(ombPath + omb); File ombFile = new File(ombPath + omb); if (ombFile.exists()) { txtOmbFile.setBackground(Color.WHITE); btnRefresh.setEnabled(false); comboBoxSelectProject.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); progressBarSimulation.setVisible(true); progressBarSimulation.setStringPainted(true); progressBarSimulation.setIndeterminate(true); refreshTask = new Refresh(); refreshTask.execute(); } else { txtOmbFile.setBackground(new Color(255, 222, 222, 128)); JOptionPane.showMessageDialog(null, "OMB-file not found, please check the file path!", "Error", JOptionPane.ERROR_MESSAGE); } } else { txtOmbFile.setBackground(new Color(255, 222, 222, 128)); JOptionPane.showMessageDialog(null, "Please select an OMB-file!", "Warning", JOptionPane.WARNING_MESSAGE); } } }); btnRefresh.setBounds(616, 61, 124, 23); btnRefresh.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(btnRefresh); lblHelp = new JLabel( "Select an OMB-Object file to run simulations. Limited random simulations can be saved as OMS-Simulation files used for analysis."); lblHelp.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); lblHelp.setForeground(Color.GRAY); lblHelp.setBounds(10, 10, 730, 14); add(lblHelp); txtOmbFile = new JTextField(); txtOmbFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); txtOmbFile.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { setOmbFile(txtOmbFile.getText()); } }); txtOmbFile.setBounds(152, 33, 454, 20); add(txtOmbFile); txtOmbFile.setColumns(10); btnBrowseOmb = new JButton("Browse"); btnBrowseOmb.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); btnBrowseOmb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser fileDialog = new JFileChooser(); fileDialog.setFileFilter(new FileNameExtensionFilter("*.omb", "omb")); fileDialog.showOpenDialog(getParent()); final File file = fileDialog.getSelectedFile(); if (file != null) { String omb; String[] tmpFileName = file.getAbsolutePath().split("\\."); if (tmpFileName[tmpFileName.length - 1].equals("omb")) { omb = ""; } else { omb = ".omb"; } txtOmbFile.setText(file.getAbsolutePath() + omb); setOmbFile(file.getAbsolutePath() + omb); } } }); btnBrowseOmb.setBounds(616, 32, 124, 23); add(btnBrowseOmb); rdbtnSystematic = new JRadioButton("Systematic all campaigns"); rdbtnSystematic.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { if (rdbtnSystematic.isSelected()) { setSystematic(true); rdbtnRandom.setSelected(false); chckbxRatio6.setEnabled(false); chckbxRatio5.setEnabled(false); chckbxRatio4.setEnabled(false); chckbxRatio3.setEnabled(false); spnrRatio6.setEnabled(false); spnrRatio5.setEnabled(false); spnrRatio4.setEnabled(false); spnrRatio3.setEnabled(false); spnrRandomCampaigns.setEnabled(false); lblRatio.setEnabled(false); lblCampaigns.setEnabled(false); lblOmsFile.setEnabled(false); lblWarning.setVisible(true); txtOmsFile.setEnabled(false); btnBrowseOms.setEnabled(false); } else { setSystematic(false); rdbtnRandom.setSelected(true); } } }); rdbtnSystematic.setBounds(152, 90, 259, 23); rdbtnSystematic.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(rdbtnSystematic); rdbtnRandom = new JRadioButton("Random"); rdbtnRandom.setSelected(true); rdbtnRandom.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (rdbtnRandom.isSelected()) { setSystematic(false); rdbtnSystematic.setSelected(false); chckbxRatio6.setEnabled(true); chckbxRatio5.setEnabled(true); chckbxRatio4.setEnabled(true); chckbxRatio3.setEnabled(true); spnrRandomCampaigns.setEnabled(true); lblRatio.setEnabled(true); lblCampaigns.setEnabled(true); lblOmsFile.setEnabled(true); lblWarning.setVisible(false); txtOmsFile.setEnabled(true); btnBrowseOms.setEnabled(true); } else { setSystematic(true); rdbtnSystematic.setSelected(true); } } }); rdbtnRandom.setBounds(152, 119, 142, 23); rdbtnRandom.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(rdbtnRandom); comboBoxSelectProject = new JComboBox<OMBuilding>(); comboBoxSelectProject.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent arg0) { boolean b = false; if (comboBoxSelectProject.isEnabled()) { if (comboBoxSelectProject.getSelectedItem() != null) { b = true; setSelectedObject((OMBuilding) comboBoxSelectProject.getSelectedItem()); setProjectName(getSelectedObject().getName()); } else { b = false; } } else { b = false; } progressBarSimulation.setEnabled(b); btnStart.setEnabled(b); chckbxRandomNoise.setEnabled(b); rdbtnRandom.setEnabled(b); rdbtnSystematic.setEnabled(b); lblPercent.setEnabled(b); lblRatio.setEnabled(b); lblSimulationType.setEnabled(b); lblCampaigns.setEnabled(b); } }); comboBoxSelectProject.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { boolean b = false; if (comboBoxSelectProject.isEnabled()) { if (comboBoxSelectProject.getSelectedItem() != null) { b = true; setSelectedObject((OMBuilding) comboBoxSelectProject.getSelectedItem()); setProjectName(getSelectedObject().getName()); } else { b = false; } } else { b = false; } progressBarSimulation.setEnabled(b); btnStart.setEnabled(b); chckbxRandomNoise.setEnabled(b); rdbtnRandom.setEnabled(b); rdbtnSystematic.setEnabled(b); lblPercent.setEnabled(b); lblRatio.setEnabled(b); lblSimulationType.setEnabled(b); lblCampaigns.setEnabled(b); } }); comboBoxSelectProject.setBounds(152, 61, 454, 22); comboBoxSelectProject.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); add(comboBoxSelectProject); btnStart.setEnabled(false); chckbxRandomNoise.setEnabled(false); chckbxRatio6.setEnabled(false); chckbxRatio5.setEnabled(false); chckbxRatio4.setEnabled(false); chckbxRatio3.setEnabled(false); spnrRandomNoise.setEnabled(false); spnrRatio6.setEnabled(false); spnrRatio5.setEnabled(false); spnrRatio4.setEnabled(false); spnrRatio3.setEnabled(false); spnrRandomCampaigns.setEnabled(false); rdbtnRandom.setEnabled(false); rdbtnSystematic.setEnabled(false); lblPercent.setEnabled(false); lblRatio.setEnabled(false); lblSimulationType.setEnabled(false); lblCampaigns.setEnabled(false); lblOmsFile.setEnabled(false); txtOmsFile.setEnabled(false); btnBrowseOms.setEnabled(false); spnrRatio6.setValue(73); spnrRatio5.setValue(20); spnrRatio4.setValue(5); spnrRatio3.setValue(2); spnrRandomNoise.setValue(5); lblWarning.setVisible(false); }
From source file:com.xilinx.ultrascale.gui.MainScreen.java
public void loadVideo() { ControlPanel.add(VideoPanel);/*from w ww . ja v a2 s . c o m*/ VideoPanel.setSize(ControlPanel.getSize()); ControlPanel.repaint(); ControlPanel.revalidate(); maxcoeff.setModel(new SpinnerNumberModel(200, 0, 255, 1)); mincoeff.setModel(new SpinnerNumberModel(100, 0, 255, 1)); }
From source file:com.xilinx.ultrascale.gui.MainScreen_video.java
public void loadVideo() { sysout("adding other parametes"); ControlPanel.add(VideoPanel);/*w w w.j a va 2 s. co m*/ VideoPanel.setSize(ControlPanel.getSize()); ControlPanel.repaint(); ControlPanel.revalidate(); initVideoPlayer(); maxcoeff.setModel(new SpinnerNumberModel(255, 0, 255, 1)); mincoeff.setModel(new SpinnerNumberModel(0, 0, 255, 1)); }
From source file:com.peterbochs.PeterBochsDebugger.java
private JSpinner getJShowAfterwardSpinner() { if (jShowAfterwardSpinner == null) { SpinnerNumberModel jShowAfterwardSpinnerModel = new SpinnerNumberModel(0, 0, 100, 1); jShowAfterwardSpinner = new JSpinner(); jShowAfterwardSpinner.setMaximumSize(new java.awt.Dimension(50, 26)); jShowAfterwardSpinner.setModel(jShowAfterwardSpinnerModel); jShowAfterwardSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { jShowAfterwardSpinnerStateChanged(evt); }//ww w . jav a 2 s.c o m }); } return jShowAfterwardSpinner; }
From source file:op.care.nursingprocess.PnlSchedule.java
private void initPanel() { pnlBemerkung.setBorder(new TitledBorder(SYSTools.xx(internalClassID + ".bordertitle4textfield"))); ArrayList<Date> timelist = SYSCalendar.getTimeList(); cmbUhrzeit.setModel(new DefaultComboBoxModel(timelist.toArray())); cmbUhrzeit.setRenderer(SYSCalendar.getTimeRenderer()); spinTaeglich.setModel(new SpinnerNumberModel(1, 1, 365, 1)); spinWoche.setModel(new SpinnerNumberModel(1, 1, 52, 1)); spinMonat.setModel(new SpinnerNumberModel(1, 1, 12, 1)); spinMonatTag.setModel(new SpinnerNumberModel(1, 1, 31, 1)); spinTaeglich.setValue(Math.max(is.getTaeglich(), 1)); spinWoche.setValue(Math.max(is.getWoechentlich(), 1)); spinMonat.setValue(Math.max(is.getMonatlich(), 1)); spinMonatTag.setValue(Math.max(is.getTagNum(), 1)); tabWdh.setSelectedIndex(TAB_DAILY);//from w w w .j a va2s . com if (is.getWoechentlich() > 0) { cbMon.setSelected(is.getMon() > 0); cbDie.setSelected(is.getDie() > 0); cbMit.setSelected(is.getMit() > 0); cbDon.setSelected(is.getDon() > 0); cbFre.setSelected(is.getFre() > 0); cbSam.setSelected(is.getSam() > 0); cbSon.setSelected(is.getSon() > 0); tabWdh.setSelectedIndex(TAB_WEEKLY); } if (is.getMonatlich() > 0) { if (is.getTagNum() > 0) { spinMonatTag.setValue(is.getTagNum()); cmbTag.setSelectedIndex(0); } else { if (is.getMon() > 0) { cmbTag.setSelectedIndex(1); spinMonatTag.setValue(is.getMon()); } else if (is.getDie() > 0) { cmbTag.setSelectedIndex(2); spinMonatTag.setValue(is.getDie()); } else if (is.getMit() > 0) { cmbTag.setSelectedIndex(3); spinMonatTag.setValue(is.getMit()); } else if (is.getDon() > 0) { cmbTag.setSelectedIndex(4); spinMonatTag.setValue(is.getDon()); } else if (is.getFre() > 0) { cmbTag.setSelectedIndex(5); spinMonatTag.setValue(is.getFre()); } else if (is.getSam() > 0) { cmbTag.setSelectedIndex(6); spinMonatTag.setValue(is.getSam()); } else if (is.getSon() > 0) { cmbTag.setSelectedIndex(7); spinMonatTag.setValue(is.getSon()); } } tabWdh.setSelectedIndex(TAB_MONTHLY); } txtLDate.setText(DateFormat.getDateInstance() .format(new Date(Math.max(is.getLDatum().getTime(), new DateMidnight().getMillis())))); txtNachtMo.setText(is.getNachtMo().toString()); txtMorgens.setText(is.getMorgens().toString()); txtMittags.setText(is.getMittags().toString()); txtNachmittags.setText(is.getNachmittags().toString()); txtAbends.setText(is.getAbends().toString()); txtNachtAb.setText(is.getNachtAb().toString()); txtUhrzeit.setText(is.getUhrzeitAnzahl().toString()); txtMorgens.setBackground(SYSConst.lightblue); txtMittags.setBackground(SYSConst.gold7); txtNachmittags.setBackground(SYSConst.melonrindgreen); txtAbends.setBackground(SYSConst.bermuda_sand); txtNachtAb.setBackground(SYSConst.bluegrey); Date now = null; if (is.getUhrzeitAnzahl() > 0) { now = is.getUhrzeit(); } else { now = new Date(); } for (Date zeit : timelist) { if (SYSCalendar.compareTime(zeit, now) >= 0) { now = zeit; break; } } cmbUhrzeit.setSelectedItem(now); lblUhrzeit.setText(SYSTools.xx("misc.msg.Number")); txtBemerkung.setText(is.getBemerkung()); lblMinutes.setText(SYSTools.xx("misc.msg.Minute(s)")); txtMinutes.setText(is.getDauer().toPlainString()); tbFloating = GUITools.getNiceToggleButton(SYSTools.xx(internalClassID + ".floatinginterventions")); tbFloating.setSelected(is.isFloating()); panelMain.add(tbFloating, CC.xy(3, 5)); splitRegularPos = SYSTools.showSide(splitRegular, is.getUhrzeit() != null ? SYSTools.RIGHT_LOWER_SIDE : SYSTools.LEFT_UPPER_SIDE); }
From source file:op.care.nursingprocess.PnlSchedule.java
/** * This method is called from within the constructor to * initialize the form./*from w ww. jav a 2 s .co 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(); splitRegular = new JSplitPane(); pnlTageszeit = new JPanel(); jLabel6 = new JideLabel(); jLabel1 = new JideLabel(); jLabel2 = new JideLabel(); jLabel11 = new JideLabel(); jLabel3 = new JideLabel(); jLabel4 = new JideLabel(); txtNachtMo = new JTextField(); txtMorgens = new JTextField(); txtMittags = new JTextField(); txtNachmittags = new JTextField(); txtAbends = new JTextField(); txtNachtAb = new JTextField(); btnToTime = new JButton(); pnlUhrzeit = new JPanel(); lblUhrzeit = new JideLabel(); btnToTimeOfDay = new JButton(); txtUhrzeit = new JTextField(); cmbUhrzeit = new JComboBox(); tabWdh = new JideTabbedPane(); pnlDaily = new JPanel(); label3 = new JLabel(); spinTaeglich = new JSpinner(); jLabel7 = new JLabel(); btnJedenTag = new JButton(); pnlWeekly = new JPanel(); panel3 = new JPanel(); btnJedeWoche = new JButton(); label2 = new JLabel(); spinWoche = new JSpinner(); jLabel8 = 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 JCheckBox(); cbDie = new JCheckBox(); cbMit = new JCheckBox(); cbDon = new JCheckBox(); cbFre = new JCheckBox(); cbSam = new JCheckBox(); cbSon = new JCheckBox(); pnlMonthly = new JPanel(); label4 = new JLabel(); spinMonat = new JSpinner(); label6 = new JLabel(); btnJedenMonat = new JButton(); label5 = new JLabel(); spinMonatTag = new JSpinner(); cmbTag = new JComboBox<>(); panel2 = new JPanel(); jLabel13 = new JLabel(); txtLDate = new JTextField(); lblMinutes = new JLabel(); txtMinutes = new JTextField(); pnlBemerkung = new JPanel(); jScrollPane1 = new JScrollPane(); txtBemerkung = new JTextArea(); btnSave = new JButton(); //======== 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, 223dlu:grow, $lcgap, $rgap", "$rgap, $lgap, pref, $lgap, default, $lgap, pref, $lgap, default, $lgap, 72dlu:grow, 2*($lgap, default)")); //======== splitRegular ======== { splitRegular.setDividerSize(0); splitRegular.setEnabled(false); splitRegular.setDividerLocation(150); splitRegular.setDoubleBuffered(true); //======== pnlTageszeit ======== { pnlTageszeit.setFont(new Font("Arial", Font.PLAIN, 14)); pnlTageszeit.setBorder(new EtchedBorder()); pnlTageszeit.setLayout( new FormLayout("6*(28dlu, $lcgap), default", "fill:default, $lgap, fill:default")); //---- jLabel6 ---- jLabel6.setText("Nachts, fr\u00fch morgens"); jLabel6.setOrientation(1); jLabel6.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel6.setClockwise(false); jLabel6.setHorizontalTextPosition(SwingConstants.LEFT); pnlTageszeit.add(jLabel6, CC.xy(1, 1)); //---- jLabel1 ---- jLabel1.setForeground(new Color(0, 0, 204)); jLabel1.setText("Morgens"); jLabel1.setOrientation(1); jLabel1.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel1.setClockwise(false); jLabel1.setHorizontalTextPosition(SwingConstants.LEFT); pnlTageszeit.add(jLabel1, CC.xy(3, 1)); //---- jLabel2 ---- jLabel2.setForeground(new Color(255, 102, 0)); jLabel2.setText("Mittags"); jLabel2.setOrientation(1); jLabel2.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel2.setClockwise(false); jLabel2.setHorizontalTextPosition(SwingConstants.LEFT); pnlTageszeit.add(jLabel2, CC.xy(5, 1)); //---- jLabel11 ---- jLabel11.setForeground(new Color(0, 153, 51)); jLabel11.setText("Nachmittag"); jLabel11.setOrientation(1); jLabel11.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel11.setClockwise(false); jLabel11.setHorizontalTextPosition(SwingConstants.LEFT); pnlTageszeit.add(jLabel11, CC.xy(7, 1)); //---- jLabel3 ---- jLabel3.setForeground(new Color(255, 0, 51)); jLabel3.setText("Abends"); jLabel3.setOrientation(1); jLabel3.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel3.setClockwise(false); jLabel3.setHorizontalTextPosition(SwingConstants.LEFT); pnlTageszeit.add(jLabel3, CC.xy(9, 1)); //---- jLabel4 ---- jLabel4.setText("Nacht, sp\u00e4t abends"); jLabel4.setOrientation(1); jLabel4.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel4.setClockwise(false); jLabel4.setHorizontalTextPosition(SwingConstants.LEFT); pnlTageszeit.add(jLabel4, CC.xy(11, 1)); //---- txtNachtMo ---- txtNachtMo.setHorizontalAlignment(SwingConstants.RIGHT); txtNachtMo.setText("0.0"); txtNachtMo.setFont(new Font("Arial", Font.PLAIN, 14)); txtNachtMo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtNachtMoActionPerformed(e); } }); txtNachtMo.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtIntegerFocusLost(e); } }); pnlTageszeit.add(txtNachtMo, CC.xy(1, 3)); //---- txtMorgens ---- txtMorgens.setHorizontalAlignment(SwingConstants.RIGHT); txtMorgens.setText("1.0"); txtMorgens.setFont(new Font("Arial", Font.PLAIN, 14)); txtMorgens.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMorgensActionPerformed(e); } }); txtMorgens.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtIntegerFocusLost(e); } }); pnlTageszeit.add(txtMorgens, CC.xy(3, 3)); //---- txtMittags ---- txtMittags.setHorizontalAlignment(SwingConstants.RIGHT); txtMittags.setText("0.0"); txtMittags.setFont(new Font("Arial", Font.PLAIN, 14)); txtMittags.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMittagsActionPerformed(e); } }); txtMittags.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtIntegerFocusLost(e); } }); pnlTageszeit.add(txtMittags, CC.xy(5, 3)); //---- txtNachmittags ---- txtNachmittags.setHorizontalAlignment(SwingConstants.RIGHT); txtNachmittags.setText("0.0"); txtNachmittags.setFont(new Font("Arial", Font.PLAIN, 14)); txtNachmittags.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtNachmittagsActionPerformed(e); } }); txtNachmittags.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtIntegerFocusLost(e); } }); pnlTageszeit.add(txtNachmittags, CC.xy(7, 3)); //---- txtAbends ---- txtAbends.setHorizontalAlignment(SwingConstants.RIGHT); txtAbends.setText("0.0"); txtAbends.setFont(new Font("Arial", Font.PLAIN, 14)); txtAbends.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtAbendsActionPerformed(e); } }); txtAbends.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtIntegerFocusLost(e); } }); pnlTageszeit.add(txtAbends, CC.xy(9, 3)); //---- txtNachtAb ---- txtNachtAb.setHorizontalAlignment(SwingConstants.RIGHT); txtNachtAb.setText("0.0"); txtNachtAb.setFont(new Font("Arial", Font.PLAIN, 14)); txtNachtAb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtNachtAbActionPerformed(e); } }); txtNachtAb.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtIntegerFocusLost(e); } }); pnlTageszeit.add(txtNachtAb, CC.xy(11, 3)); //---- btnToTime ---- btnToTime.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/1rightarrow.png"))); btnToTime.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnToTimeActionPerformed(e); } }); pnlTageszeit.add(btnToTime, CC.xy(13, 3)); } splitRegular.setLeftComponent(pnlTageszeit); //======== pnlUhrzeit ======== { pnlUhrzeit.setBorder(new EtchedBorder()); pnlUhrzeit.setLayout( new FormLayout("default, $ugap, 75dlu, $ugap, pref", "default:grow, $rgap, default")); //---- lblUhrzeit ---- lblUhrzeit.setText("Anzahl Massnahmen"); lblUhrzeit.setOrientation(2); lblUhrzeit.setFont(new Font("Arial", Font.PLAIN, 14)); lblUhrzeit.setClockwise(false); lblUhrzeit.setHorizontalTextPosition(SwingConstants.LEFT); lblUhrzeit.setVerticalAlignment(SwingConstants.BOTTOM); pnlUhrzeit.add(lblUhrzeit, CC.xy(3, 1, CC.DEFAULT, CC.BOTTOM)); //---- btnToTimeOfDay ---- btnToTimeOfDay .setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/1leftarrow.png"))); btnToTimeOfDay.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnToTimeOfDayActionPerformed(e); } }); pnlUhrzeit.add(btnToTimeOfDay, CC.xy(1, 3)); //---- txtUhrzeit ---- txtUhrzeit.setHorizontalAlignment(SwingConstants.RIGHT); txtUhrzeit.setText("0.0"); txtUhrzeit.setFont(new Font("Arial", Font.PLAIN, 14)); txtUhrzeit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtUhrzeitActionPerformed(e); } }); txtUhrzeit.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtIntegerFocusLost(e); } }); pnlUhrzeit.add(txtUhrzeit, CC.xy(3, 3)); //---- cmbUhrzeit ---- cmbUhrzeit.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbUhrzeitItemStateChanged(e); } }); pnlUhrzeit.add(cmbUhrzeit, CC.xy(5, 3)); } splitRegular.setRightComponent(pnlUhrzeit); } panelMain.add(splitRegular, CC.xy(3, 3)); //======== 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")); //---- label3 ---- label3.setText("alle"); label3.setFont(new Font("Arial", Font.PLAIN, 14)); pnlDaily.add(label3, 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)); //---- jLabel7 ---- jLabel7.setText("Tage"); jLabel7.setFont(new Font("Arial", Font.PLAIN, 14)); pnlDaily.add(jLabel7, 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, pref, 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)); //---- label2 ---- label2.setText("alle"); label2.setFont(new Font("Arial", Font.PLAIN, 14)); panel3.add(label2, CC.xy(1, 1)); panel3.add(spinWoche, CC.xy(3, 1)); //---- jLabel8 ---- jLabel8.setText("Wochen am"); jLabel8.setFont(new Font("Arial", Font.PLAIN, 14)); panel3.add(jLabel8, 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, 6, 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, 6, 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, 6, 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, 6, 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, 6, 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, 6, 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, 6, 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")); //---- label4 ---- label4.setText("jeden"); label4.setFont(new Font("Arial", Font.PLAIN, 14)); label4.setHorizontalAlignment(SwingConstants.TRAILING); pnlMonthly.add(label4, CC.xy(3, 3)); //---- spinMonat ---- spinMonat.setFont(new Font("Arial", Font.PLAIN, 14)); pnlMonthly.add(spinMonat, CC.xy(5, 3)); //---- label6 ---- label6.setText("Monat"); label6.setFont(new Font("Arial", Font.PLAIN, 14)); pnlMonthly.add(label6, 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)); //---- label5 ---- label5.setText("jeweils am"); label5.setFont(new Font("Arial", Font.PLAIN, 14)); label5.setHorizontalAlignment(SwingConstants.TRAILING); pnlMonthly.add(label5, CC.xy(3, 7)); //---- spinMonatTag ---- spinMonatTag.setFont(new Font("Arial", Font.PLAIN, 14)); spinMonatTag.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { spinMonatTagStateChanged(e); } }); pnlMonthly.add(spinMonatTag, 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)); pnlMonthly.add(cmbTag, CC.xywh(7, 7, 3, 1)); } tabWdh.addTab("Monatlich", pnlMonthly); } panelMain.add(tabWdh, CC.xy(3, 7, CC.FILL, CC.FILL)); //======== panel2 ======== { panel2.setLayout(new FormLayout( "default, $lcgap, default:grow, $ugap, default, $lcgap, default:grow", "default:grow")); //---- jLabel13 ---- jLabel13.setText("Erst einplanen ab dem"); jLabel13.setFont(new Font("Arial", Font.PLAIN, 14)); panel2.add(jLabel13, CC.xy(1, 1)); //---- txtLDate ---- txtLDate.setFont(new Font("Arial", Font.PLAIN, 14)); txtLDate.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtLDateFocusLost(e); } }); panel2.add(txtLDate, CC.xy(3, 1)); //---- lblMinutes ---- lblMinutes.setText("text"); lblMinutes.setFont(new Font("Arial", Font.PLAIN, 14)); panel2.add(lblMinutes, CC.xy(5, 1)); //---- txtMinutes ---- txtMinutes.setFont(new Font("Arial", Font.PLAIN, 14)); txtMinutes.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtMinutesFocusLost(e); } }); panel2.add(txtMinutes, CC.xy(7, 1)); } panelMain.add(panel2, CC.xy(3, 9)); //======== pnlBemerkung ======== { pnlBemerkung.setBorder(new TitledBorder(null, "Kommentar zur Anwendung (Erscheint im DFN)", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, new Font("Arial", Font.PLAIN, 14))); pnlBemerkung.setLayout(new BoxLayout(pnlBemerkung, BoxLayout.X_AXIS)); //======== jScrollPane1 ======== { //---- txtBemerkung ---- txtBemerkung.setColumns(20); txtBemerkung.setRows(5); jScrollPane1.setViewportView(txtBemerkung); } pnlBemerkung.add(jScrollPane1); } panelMain.add(pnlBemerkung, CC.xy(3, 11, CC.FILL, 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(3, 13, CC.RIGHT, CC.DEFAULT)); } add(panelMain, BorderLayout.CENTER); }
From source file:op.controlling.PnlQMSSchedule.java
private void cmbTagItemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (cmbTag.getSelectedIndex() == 0) { spinDayInMonth.setModel(new SpinnerNumberModel(1, 1, 31, 1)); } else {/* ww w. ja va 2 s .co m*/ spinDayInMonth.setModel(new SpinnerNumberModel(1, 1, 5, 1)); } } }
From source file:op.controlling.PnlQMSSchedule.java
private void initPanel() { i18n();//from www . j a v a2 s . c om txtDueDays.setText(Integer.toString(qmssched.getDuedays())); spinTaeglich.setModel(new SpinnerNumberModel(1, 1, 365, 1)); spinWoche.setModel(new SpinnerNumberModel(1, 1, 52, 1)); spinMonat.setModel(new SpinnerNumberModel(1, 1, 12, 1)); spinYearly.setModel(new SpinnerNumberModel(1, 1, 10, 1)); spinDayInMonth.setModel(new SpinnerNumberModel(1, 1, 31, 1)); spinTaeglich.setValue(Math.max(qmssched.getDaily(), 1)); spinWoche.setValue(Math.max(qmssched.getWeekly(), 1)); spinMonat.setValue(Math.max(qmssched.getMonthly(), 1)); spinDayInMonth.setValue(Math.max(qmssched.getDayinmonth(), 1)); spinYearly.setValue(Math.max(qmssched.getYearly(), 1)); cbMon.setSelected(true); cmbMonth.setSelectedIndex(qmssched.isYearly() ? qmssched.getMonthinyear() - 1 : 0); spinDayInMonthInYear.setModel(new SpinnerNumberModel(qmssched.isYearly() ? qmssched.getDayinmonth() : 1, 1, maxdays[cmbMonth.getSelectedIndex()], 1)); cmbMonth.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { spinDayInMonthInYear .setModel(new SpinnerNumberModel(1, 1, maxdays[cmbMonth.getSelectedIndex()], 1)); } } }); if (qmssched.isDaily()) { tabWdh.setSelectedIndex(TAB_DAILY); } else if (qmssched.isWeekly()) { cbMon.setSelected(qmssched.getWeekday() == DateTimeConstants.MONDAY); cbDie.setSelected(qmssched.getWeekday() == DateTimeConstants.TUESDAY); cbMit.setSelected(qmssched.getWeekday() == DateTimeConstants.WEDNESDAY); cbDon.setSelected(qmssched.getWeekday() == DateTimeConstants.THURSDAY); cbFre.setSelected(qmssched.getWeekday() == DateTimeConstants.FRIDAY); cbSam.setSelected(qmssched.getWeekday() == DateTimeConstants.SATURDAY); cbSon.setSelected(qmssched.getWeekday() == DateTimeConstants.SUNDAY); tabWdh.setSelectedIndex(TAB_WEEKLY); } else if (qmssched.isMonthly()) { spinDayInMonth.setValue(qmssched.getDayinmonth()); cmbTag.setSelectedIndex(qmssched.getWeekday()); tabWdh.setSelectedIndex(TAB_MONTHLY); } else if (qmssched.isYearly()) { spinYearly.setValue(qmssched.getYearly()); spinDayInMonthInYear.setValue(qmssched.getDayinmonth()); cmbMonth.setSelectedIndex(qmssched.getMonthinyear() - 1); tabWdh.setSelectedIndex(TAB_YEARLY); } jdcStartingOn.setMinSelectableDate(new Date()); jdcStartingOn.setDate(qmssched.getStartingOn()); ArrayList<Date> timelist = SYSCalendar.getTimeList(); DefaultComboBoxModel dcbm = new DefaultComboBoxModel(timelist.toArray()); dcbm.insertElementAt(null, 0); txtBemerkung.setText(qmssched.getText()); txtQMS.setText(qmssched.getMeasure()); cmbLocation.setTreeModel(new DefaultTreeModel(StationTools.getCompleteStructure())); Object userObject = null; if (qmssched.getHome() != null) { userObject = qmssched.getHome(); } else if (qmssched.getStation() != null) { userObject = qmssched.getStation(); } int row = 0; if (userObject == null) { cmbLocation.setSelectedItem(null); } else { DefaultMutableTreeNode root = (DefaultMutableTreeNode) cmbLocation.getTreeModel().getRoot(); DefaultMutableTreeNode theNode = null; for (Enumeration e = root.depthFirstEnumeration(); e.hasMoreElements() && theNode == null;) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement(); if (userObject.equals(node.getUserObject())) { cmbLocation.setSelectedItem(node); break; } row++; } } }
From source file:op.controlling.PnlQMSSchedule.java
/** * This method is called from within the constructor to * initialize the form./* w w w. j ava2 s . co 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); }