List of usage examples for java.awt GridBagConstraints NONE
int NONE
To view the source code for java.awt GridBagConstraints NONE.
Click Source Link
From source file:us.paulevans.basicxslt.TransformOutputPropertiesFrame.java
/** * Builds the method panel//from www . j a v a 2 s .c om * @return */ private JPanel buildMethodPanel() { int row; ButtonGroup group; GridBagLayout layout; GridBagConstraints constraints; JPanel panel; row = 0; group = new ButtonGroup(); layout = new GridBagLayout(); constraints = new GridBagConstraints(); panel = new JPanel(layout); GUIUtils.add(panel, xml = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_XML) + " | "), layout, constraints, row, 0, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, html = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_HTML) + " | "), layout, constraints, row, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, text = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_TEXT) + " | "), layout, constraints, row, 2, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, other = new JRadioButton( stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_OTHER)), layout, constraints, row, 3, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); GUIUtils.add(panel, otherMethod = new JTextField(10), layout, constraints, row, 4, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.NO_INSETS); group.add(xml); group.add(html); group.add(text); group.add(other); xml.addActionListener(this); html.addActionListener(this); text.addActionListener(this); other.addActionListener(this); xml.setSelected(true); otherMethod.setEnabled(false); otherMethod.setBackground(Color.LIGHT_GRAY); return panel; }
From source file:cool.pandora.modeller.ui.jpanel.base.SaveBagFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/*from w ww . ja v a 2s .c om*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("SaveBagFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Define the Bag " + "settings"))); titlePaneContainer.add(titlePane.getControl()); titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH); pageControl.add(titlePaneContainer, BorderLayout.NORTH); final JPanel contentPane = new JPanel(); // TODO: Add bag name field // TODO: Add save name file selection button final JLabel location = new JLabel("Save in:"); final JButton browseButton = new JButton(getMessage("bag.button.browse")); browseButton.addActionListener(new SaveBagAsHandler()); browseButton.setEnabled(true); browseButton.setToolTipText(getMessage("bag.button.browse.help")); final DefaultBag bag = bagView.getBag(); if (bag != null) { bagNameField = new JTextField(bag.getName()); bagNameField.setCaretPosition(bag.getName().length()); bagNameField.setEditable(false); bagNameField.setEnabled(false); } // Holey bag control final JLabel holeyLabel = new JLabel(bagView.getPropertyMessage("bag.label.isholey")); holeyLabel.setToolTipText(bagView.getPropertyMessage("bag.isholey.help")); final JCheckBox holeyCheckbox = new JCheckBox(bagView.getPropertyMessage("bag.checkbox" + ".isholey")); holeyCheckbox.setBorder(border); holeyCheckbox.addActionListener(new HoleyBagHandler()); holeyCheckbox.setToolTipText(bagView.getPropertyMessage("bag.isholey.help")); urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label")); urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description")); urlField = new JTextField(""); try { assert bag != null; urlField.setText(bag.getFetch().getBaseURL()); } catch (Exception e) { log.error("Failed to set url label", e); } urlField.setEnabled(false); // TODO: Add format label final JLabel serializeLabel; serializeLabel = new JLabel(getMessage("bag.label.ispackage")); serializeLabel.setToolTipText(getMessage("bag.serializetype.help")); // TODO: Add format selection panel noneButton = new JRadioButton(getMessage("bag.serializetype.none")); noneButton.setEnabled(true); final AbstractAction serializeListener = new SerializeBagHandler(); noneButton.addActionListener(serializeListener); noneButton.setToolTipText(getMessage("bag.serializetype.none.help")); zipButton = new JRadioButton(getMessage("bag.serializetype.zip")); zipButton.setEnabled(true); zipButton.addActionListener(serializeListener); zipButton.setToolTipText(getMessage("bag.serializetype.zip.help")); /* * tarButton = new JRadioButton(getMessage("bag.serializetype.tar")); * tarButton.setEnabled(true); * tarButton.addActionListener(serializeListener); * tarButton.setToolTipText(getMessage("bag.serializetype.tar.help")); * * tarGzButton = new JRadioButton(getMessage("bag.serializetype.targz")); * tarGzButton.setEnabled(true); * tarGzButton.addActionListener(serializeListener); * tarGzButton.setToolTipText(getMessage("bag.serializetype.targz.help")); * * tarBz2Button = new JRadioButton(getMessage("bag.serializetype.tarbz2")); * tarBz2Button.setEnabled(true); * tarBz2Button.addActionListener(serializeListener); * tarBz2Button.setToolTipText(getMessage("bag.serializetype.tarbz2.help")); */ short mode = 2; if (bag != null) { mode = bag.getSerialMode(); } if (mode == DefaultBag.NO_MODE) { this.noneButton.setEnabled(true); } else if (mode == DefaultBag.ZIP_MODE) { this.zipButton.setEnabled(true); } else { this.noneButton.setEnabled(true); } final ButtonGroup serializeGroup = new ButtonGroup(); serializeGroup.add(noneButton); serializeGroup.add(zipButton); // serializeGroup.add(tarButton); // serializeGroup.add(tarGzButton); // serializeGroup.add(tarBz2Button); final JPanel serializeGroupPanel = new JPanel(new FlowLayout()); serializeGroupPanel.add(serializeLabel); serializeGroupPanel.add(noneButton); serializeGroupPanel.add(zipButton); // serializeGroupPanel.add(tarButton); // serializeGroupPanel.add(tarGzButton); // serializeGroupPanel.add(tarBz2Button); serializeGroupPanel.setBorder(border); serializeGroupPanel.setEnabled(true); serializeGroupPanel.setToolTipText(bagView.getPropertyMessage("bag.serializetype.help")); final JLabel tagLabel = new JLabel(getMessage("bag.label.istag")); tagLabel.setToolTipText(getMessage("bag.label.istag.help")); final JCheckBox isTagCheckbox = new JCheckBox(); isTagCheckbox.setBorder(border); isTagCheckbox.addActionListener(new TagManifestHandler()); isTagCheckbox.setToolTipText(getMessage("bag.checkbox.istag.help")); final JLabel tagAlgorithmLabel = new JLabel(getMessage("bag.label.tagalgorithm")); tagAlgorithmLabel.setToolTipText(getMessage("bag.label.tagalgorithm.help")); final ArrayList<String> listModel = new ArrayList<>(); for (final Algorithm algorithm : Algorithm.values()) { listModel.add(algorithm.bagItAlgorithm); } final JComboBox<String> tagAlgorithmList = new JComboBox<>(listModel.toArray(new String[listModel.size()])); tagAlgorithmList.setName(getMessage("bag.tagalgorithmlist")); tagAlgorithmList.addActionListener(new TagAlgorithmListHandler()); tagAlgorithmList.setToolTipText(getMessage("bag.tagalgorithmlist.help")); final JLabel payloadLabel = new JLabel(getMessage("bag.label.ispayload")); payloadLabel.setToolTipText(getMessage("bag.ispayload.help")); final JCheckBox isPayloadCheckbox = new JCheckBox(); isPayloadCheckbox.setBorder(border); isPayloadCheckbox.addActionListener(new PayloadManifestHandler()); isPayloadCheckbox.setToolTipText(getMessage("bag.ispayload.help")); final JLabel payAlgorithmLabel = new JLabel(bagView.getPropertyMessage("bag.label" + ".payalgorithm")); payAlgorithmLabel.setToolTipText(getMessage("bag.payalgorithm.help")); final JComboBox<String> payAlgorithmList = new JComboBox<String>( listModel.toArray(new String[listModel.size()])); payAlgorithmList.setName(getMessage("bag.payalgorithmlist")); payAlgorithmList.addActionListener(new PayAlgorithmListHandler()); payAlgorithmList.setToolTipText(getMessage("bag.payalgorithmlist.help")); //only if bag is not null if (bag != null) { final String fileName = bag.getName(); bagNameField = new JTextField(fileName); bagNameField.setCaretPosition(fileName.length()); holeyCheckbox.setSelected(bag.isHoley()); urlLabel.setEnabled(bag.isHoley()); isTagCheckbox.setSelected(bag.isBuildTagManifest()); tagAlgorithmList.setSelectedItem(bag.getTagManifestAlgorithm()); isPayloadCheckbox.setSelected(bag.isBuildPayloadManifest()); payAlgorithmList.setSelectedItem(bag.getPayloadManifestAlgorithm()); } final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints glbc = new GridBagConstraints(); final JPanel panel = new JPanel(layout); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); int row = 0; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(location, glbc); panel.add(location); buildConstraints(glbc, 2, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); glbc.ipadx = 5; layout.setConstraints(browseButton, glbc); glbc.ipadx = 0; panel.add(browseButton); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); glbc.ipadx = 5; layout.setConstraints(bagNameField, glbc); glbc.ipadx = 0; panel.add(bagNameField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(holeyLabel, glbc); panel.add(holeyLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.WEST, GridBagConstraints.WEST); layout.setConstraints(holeyCheckbox, glbc); panel.add(holeyCheckbox); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(urlLabel, glbc); panel.add(urlLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(urlField, glbc); panel.add(urlField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(serializeLabel, glbc); panel.add(serializeLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); layout.setConstraints(serializeGroupPanel, glbc); panel.add(serializeGroupPanel); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(tagLabel, glbc); panel.add(tagLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(isTagCheckbox, glbc); panel.add(isTagCheckbox); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(tagAlgorithmLabel, glbc); panel.add(tagAlgorithmLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(tagAlgorithmList, glbc); panel.add(tagAlgorithmList); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(payloadLabel, glbc); panel.add(payloadLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(isPayloadCheckbox, glbc); panel.add(isPayloadCheckbox); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(payAlgorithmLabel, glbc); panel.add(payAlgorithmLabel); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(payAlgorithmList, glbc); panel.add(payAlgorithmList); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GuiStandardUtils.attachDialogBorder(contentPane); pageControl.add(panel); final JComponent buttonBar = createButtonBar(); pageControl.add(buttonBar, BorderLayout.SOUTH); this.pack(); return pageControl; }
From source file:com.att.aro.ui.view.menu.tools.RegexWizard.java
private JPanel getFieldPanel() { if (fieldPanel == null) { fieldPanel = new JPanel(); fieldPanel.addComponentListener(this); fieldPanel.setLayout(new GridBagLayout()); GridBagConstraints constraint = new GridBagConstraints(); constraint.gridx = 0;// w w w . j a va 2s . co m constraint.gridy = 0; constraint.insets = new Insets(0, 5, 0, 5); constraint.anchor = GridBagConstraints.FIRST_LINE_START; constraint.weightx = 1; constraint.fill = GridBagConstraints.HORIZONTAL; cbRequest = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true); cbRequest.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { requestField.setEditable(cbRequest.isSelected()); } }); cbHeader = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true); cbHeader.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { headerField.setEditable(cbHeader.isSelected()); } }); cbResponse = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true); cbResponse.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { responseField.setEditable(cbResponse.isSelected()); } }); compileResultsField = new JTextField(); compileResultsField.setEditable(false); compileResultsField.setBackground(fieldPanel.getBackground()); compileResultsField.setForeground(Color.red); compileResultsField.setFont(compileResultsField.getFont().deriveFont(Font.BOLD)); requestField = createTextAreaAndProperties( ResourceBundleHelper.getMessageString("videotab.label.request")); requestField.setName(ResourceBundleHelper.getMessageString("videotab.field.request")); regexRequestField = createTextAreaAndProperties( ResourceBundleHelper.getMessageString("videotab.label.regex.request")); regexRequestField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.request")); responseField = createTextAreaAndProperties( ResourceBundleHelper.getMessageString("videotab.label.response")); responseField.setName(ResourceBundleHelper.getMessageString("videotab.field.response")); regexResponseField = createTextAreaAndProperties( ResourceBundleHelper.getMessageString("videotab.label.regex.response")); regexResponseField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.response")); headerField = createTextAreaAndProperties( ResourceBundleHelper.getMessageString("videotab.label.header")); headerField.setName(ResourceBundleHelper.getMessageString("videotab.field.header")); regexHeaderField = createTextAreaAndProperties( ResourceBundleHelper.getMessageString("videotab.label.regex.header")); regexHeaderField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.header")); fieldPanel.add(compileResultsField, constraint); constraint.gridy = 1; constraint.anchor = GridBagConstraints.WEST; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.EAST; fieldPanel.add(cbRequest, constraint); constraint.gridy = 2; constraint.anchor = GridBagConstraints.WEST; constraint.fill = GridBagConstraints.HORIZONTAL; fieldPanel.add(requestField, constraint); constraint.gridy = 3; constraint.fill = GridBagConstraints.HORIZONTAL; constraint.anchor = GridBagConstraints.WEST; fieldPanel.add(regexRequestField, constraint); constraint.gridy = 4; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; constraint.anchor = GridBagConstraints.EAST; fieldPanel.add(cbHeader, constraint); constraint.gridy = 5; constraint.fill = GridBagConstraints.HORIZONTAL; fieldPanel.add(headerField, constraint); constraint.gridy = 6; fieldPanel.add(regexHeaderField, constraint); constraint.gridy = 7; constraint.fill = GridBagConstraints.NONE; constraint.anchor = GridBagConstraints.WEST; constraint.anchor = GridBagConstraints.EAST; fieldPanel.add(cbResponse, constraint); constraint.gridy = 8; constraint.anchor = GridBagConstraints.WEST; constraint.fill = GridBagConstraints.HORIZONTAL; fieldPanel.add(responseField, constraint); constraint.gridy = 9; constraint.fill = GridBagConstraints.HORIZONTAL; fieldPanel.add(regexResponseField, constraint); } return fieldPanel; }
From source file:course_generator.param.frmEditCurve.java
/** * This method is called to initialize the form. *//*from www .j a v a 2s . com*/ private void initComponents() { int line = 0; setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle(bundle.getString("frmEditCurve.title")); setPreferredSize(new Dimension(1200, 600)); setAlwaysOnTop(true); setResizable(false); setType(java.awt.Window.Type.UTILITY); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); // -- Layout // ------------------------------------------------------------ Container paneGlobal = getContentPane(); paneGlobal.setLayout(new GridBagLayout()); //-- Curves list ListCurves = new javax.swing.JList<>(); model = new ParamListModel(); ListCurves.setModel(model); ListCurves.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); ListCurves.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { SelectCurve(); } }); jScrollPaneCurves = new javax.swing.JScrollPane(); jScrollPaneCurves.setViewportView(ListCurves); Utils.addComponent(paneGlobal, jScrollPaneCurves, 0, 0, 1, 4, 0.5, 1, 10, 10, 0, 0, GridBagConstraints.PAGE_START, GridBagConstraints.BOTH); //-- Curve management toolbar CreateCurvesToolbar(); Utils.addComponent(paneGlobal, ToolBarAction, 1, 0, 1, 4, 0, 0, 10, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH); lbSelectedCurve = new javax.swing.JLabel(); lbSelectedCurve.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lbSelectedCurve.setText("Selected"); lbSelectedCurve.setHorizontalAlignment(JLabel.LEFT); Utils.addComponent(paneGlobal, lbSelectedCurve, 2, 0, GridBagConstraints.REMAINDER, 1, 1, 0, 10, 0, 5, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL); //-- Curve name lbName = new javax.swing.JLabel(); lbName.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lbName.setText(" " + bundle.getString("frmEditCurve.lbName.text") + " "); Utils.addComponent(paneGlobal, lbName, 2, 1, 1, 1, 0, 0, 0, 0, 5, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL); lbNameVal = new javax.swing.JLabel(); lbNameVal.setBorder(javax.swing.BorderFactory.createEtchedBorder()); Utils.addComponent(paneGlobal, lbNameVal, 3, 1, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 5, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH); //-- Curve comment lbComment = new javax.swing.JLabel(); lbComment.setBorder(javax.swing.BorderFactory.createEtchedBorder()); lbComment.setText(" " + bundle.getString("frmEditCurve.lbComment.text") + " "); Utils.addComponent(paneGlobal, lbComment, 2, 2, 1, 1, 0, 0, 0, 0, 5, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL); tfComment = new JTextField(); tfComment.setBorder(javax.swing.BorderFactory.createEtchedBorder()); Utils.addComponent(paneGlobal, tfComment, 3, 2, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 5, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL); //-- Point list TablePoints = new javax.swing.JTable(); TablePoints.setModel(tablemodel);//new ParamPointsModel(param)); TablePoints.getTableHeader().setReorderingAllowed(false); TablePoints.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { // TableMainMouseClicked(evt); } }); TablePoints.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { // TableMainKeyReleased(evt); } }); jScrollPanePoint = new javax.swing.JScrollPane(); jScrollPanePoint.setViewportView(TablePoints); Utils.addComponent(paneGlobal, jScrollPanePoint, 2, 3, 2, 1, 0.5, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH); //-- Edit toolbar CreateEditToolbar(); Utils.addComponent(paneGlobal, ToolBarEdit, 4, 3, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH); jPanelProfilChart = new ChartPanel(chart); Utils.addComponent(paneGlobal, jPanelProfilChart, 5, 3, 1, 1, 1, 0, 0, 0, 0, 10, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH); CrosshairOverlay crosshairOverlay = new CrosshairOverlay(); xCrosshair = new Crosshair(Double.NaN, Color.DARK_GRAY, new BasicStroke(0f)); xCrosshair.setLabelVisible(true); xCrosshair.setLabelBackgroundPaint(Color.WHITE); yCrosshair = new Crosshair(Double.NaN, Color.DARK_GRAY, new BasicStroke(0f)); yCrosshair.setLabelVisible(true); yCrosshair.setLabelBackgroundPaint(Color.WHITE); crosshairOverlay.addDomainCrosshair(xCrosshair); crosshairOverlay.addRangeCrosshair(yCrosshair); jPanelProfilChart.addOverlay(crosshairOverlay); jPanelProfilChart.setBackground(new java.awt.Color(255, 0, 51)); jPanelProfilChart.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent event) { ChartEntity chartentity = event.getEntity(); if (chartentity instanceof XYItemEntity) { XYItemEntity e = (XYItemEntity) chartentity; XYDataset d = e.getDataset(); int s = e.getSeriesIndex(); int i = e.getItem(); double x = d.getXValue(s, i); double y = d.getYValue(s, i); xCrosshair.setValue(x); yCrosshair.setValue(y); } } @Override public void chartMouseMoved(ChartMouseEvent event) { } }); // == Bottom button // =========================================================== btOk = new javax.swing.JButton(); btOk.setText(bundle.getString("frmEditCurve.btOk.text")); btOk.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/valid.png"))); btOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RequestToClose(); } }); Utils.addComponent(paneGlobal, btOk, 0, 5, GridBagConstraints.REMAINDER, 1, 0, 0, 10, 0, 10, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE); // -- pack(); //-- Refresh the curve list RefreshCurveList(); //-- Center the windows setLocationRelativeTo(null); }
From source file:finale.year.stage.main.Authentification.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*w w w . j a v a 2s .co m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - unknown private void initComponents() { innerPanel = new JPanel(); emailField = new JTextField(); rememberMe = new JCheckBox(); logInBtn = new JButton(); passWord = new JPasswordField(); signUpBtn = new JButton(); forgotBtn = new JButton(); userIcon = new JLabel(); passwordIcon = new JLabel(); errorStatusBar = new JLabel(); //======== this ======== // JFormDesigner evaluation mark setBorder( new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); setLayout(new GridBagLayout()); //======== innerPanel ======== { innerPanel.setBorder(new EtchedBorder()); //---- emailField ---- emailField.setText("Email"); emailField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { emailFieldActionPerformed(e); } }); //---- rememberMe ---- rememberMe.setText("Remember me"); rememberMe.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rememberMeActionPerformed(e); } }); //---- logInBtn ---- logInBtn.setText("Log In"); logInBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logInBtnActionPerformed(e); } }); //---- passWord ---- passWord.setText("password"); //---- signUpBtn ---- signUpBtn.setText("Sign Up"); signUpBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { signUpBtnActionPerformed(e); } }); //---- forgotBtn ---- forgotBtn.setText("Forgot Password?"); forgotBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { forgotBtnActionPerformed(e); } }); //---- userIcon ---- userIcon.setIcon(new ImageIcon(getClass().getResource("/Resources/glyphicons_user.png"))); //---- passwordIcon ---- passwordIcon.setIcon(new ImageIcon(getClass().getResource("/Resources/glyphicons_lock.png"))); GroupLayout innerPanelLayout = new GroupLayout(innerPanel); innerPanel.setLayout(innerPanelLayout); innerPanelLayout.setHorizontalGroup(innerPanelLayout.createParallelGroup().addGroup(innerPanelLayout .createSequentialGroup() .addGroup(innerPanelLayout.createParallelGroup() .addGroup(innerPanelLayout.createSequentialGroup().addGap(106, 106, 106) .addComponent(forgotBtn)) .addGroup(innerPanelLayout.createSequentialGroup().addGap(73, 73, 73) .addGroup(innerPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(userIcon, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE) .addComponent(passwordIcon, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(innerPanelLayout .createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(passWord).addComponent(emailField, GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE))) .addGroup(innerPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addGroup(innerPanelLayout.createSequentialGroup().addGap(106, 106, 106) .addComponent(rememberMe) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(logInBtn, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE)) .addGroup(innerPanelLayout.createSequentialGroup().addGap(375, 375, 375) .addComponent(signUpBtn, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE))) .addGroup(innerPanelLayout.createSequentialGroup().addGap(218, 218, 218) .addComponent(errorStatusBar))) .addContainerGap(100, Short.MAX_VALUE))); innerPanelLayout.setVerticalGroup(innerPanelLayout.createParallelGroup().addGroup(innerPanelLayout .createSequentialGroup().addContainerGap().addComponent(errorStatusBar).addGap(30, 30, 30) .addGroup(innerPanelLayout.createParallelGroup() .addComponent(userIcon, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(emailField, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE)) .addGap(30, 30, 30) .addGroup(innerPanelLayout.createParallelGroup() .addComponent(passwordIcon, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE) .addComponent(passWord, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( innerPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(rememberMe, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE) .addComponent(logInBtn)) .addGap(6, 6, 6).addComponent(forgotBtn).addGap(6, 6, 6).addComponent(signUpBtn) .addContainerGap(69, Short.MAX_VALUE))); } add(innerPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), -20, 4)); }
From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyMain.java
/** * This method initializes jPanel2 // w ww . j a va 2 s . com * * @return javax.swing.JPanel */ private JPanel getJPanelProjectCombo() { if (jPanelProjectCombo == null) { GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.NONE; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.insets = new Insets(0, 0, 0, 0); gridBagConstraints1.gridwidth = 1; gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.gridx = 1; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.insets = new Insets(0, 0, 0, 5); gridBagConstraints2.weightx = 1.0; gridBagConstraints2.anchor = GridBagConstraints.EAST; gridBagConstraints2.gridy = 0; jLabelProject = new JLabel(); jLabelProject.setText("Project :"); jPanelProjectCombo = new JPanel(); jPanelProjectCombo.setLayout(new GridBagLayout()); jPanelProjectCombo.setPreferredSize(new Dimension(1000, 37)); jPanelProjectCombo.add(jLabelProject, gridBagConstraints2); jPanelProjectCombo.add(getJComboProject(), gridBagConstraints1); } return jPanelProjectCombo; }
From source file:algorithm.QRCodeWatermarking.java
/** * Creates the GUI that is used to configure this algorithm. *//*from w w w . ja v a2 s.c o m*/ private void createConfigurationGui() { initButtons(); panel = new GUIPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.anchor = GridBagConstraints.NORTHWEST; constraints.gridwidth = 2; panel.add(new JLabel("<html><h2>QR-code options</h2></html>"), constraints); constraints.gridy++; constraints.gridwidth = 1; panel.add(new JLabel("QR-code size: "), constraints); constraints.gridx++; sizeField.setText("200"); panel.add(sizeField, constraints); constraints.gridwidth = 2; constraints.gridx = 0; constraints.gridy++; constraints.gridy++; constraints.gridx = 0; constraints.gridwidth = 1; panel.add(new JLabel("Select output file format:"), constraints); constraints.gridx++; panel.add(imageFormatBox, constraints); constraints.gridx = 0; constraints.gridy++; // separate file: constraints.gridwidth = 2; panel.add(falseEncapsulate, constraints); constraints.gridy++; constraints.gridy++; // add to carrier: panel.add(trueEncapsulate, constraints); constraints.gridy++; JTextArea infoArea = new JTextArea(); infoArea.setText("" + "\nPlease note: " + "\n- The QR-code will be created from the first payload file, if the dataset has more than one payload files, and added to each carrier file. " + "All other payload files will be ignored, if this option is selected." + "\n- Carrier files need to be one of the following file types:" + "\n\tpng, jpeg, jp2, jpg, bmp, gif" + "\n- All carrier files of other file formats are ignored." + "\n- The QR-code pixel size should exceed the carrier image size in no dimension." + "\n- If the size of the selected payload file is too big to create a QR-code from it, you will get an error message." + "\n\n" + "Options for adding the QR-code to the carrier images:"); infoArea.setEditable(false); infoArea.setLineWrap(true); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.weightx = 1; panel.add(infoArea, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridy++; panel.add(new JLabel("On which image position should the barcode be added?"), constraints); constraints.gridy++; constraints.gridwidth = 1; panel.add(new JLabel("X :"), constraints); constraints.gridx++; xPositionField.setText("0"); panel.add(xPositionField, constraints); constraints.gridx = 0; constraints.gridy++; panel.add(new JLabel("Y :"), constraints); constraints.gridx++; yPositionField.setText("0"); panel.add(yPositionField, constraints); constraints.gridx = 0; constraints.gridy++; constraints.gridy++; panel.add(messageLabel, constraints); }
From source file:junk.gui.HazardDataSetCalcCondorApp.java
private void jbInit() throws Exception { border1 = new EtchedBorder(EtchedBorder.RAISED, new Color(248, 254, 255), new Color(121, 124, 136)); this.setSize(new Dimension(564, 834)); this.getContentPane().setLayout(borderLayout1); mainPanel.setBorder(border1);// w w w . ja v a2 s. co m mainPanel.setLayout(gridBagLayout); mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); buttonPanel.setLayout(borderLayout3); eqkRupPanel.setLayout(gridBagLayout); imr_IMTSplit.setOrientation(JSplitPane.VERTICAL_SPLIT); imrPanel.setLayout(borderLayout2); imtPanel.setLayout(gridBagLayout); buttonPanel.setMinimumSize(new Dimension(391, 50)); gridRegionSitePanel.setLayout(gridBagLayout); imrSelectionPanel.setLayout(gridBagLayout); //controlComboBox.setBackground(Color.white); dataPanel.setLayout(gridBagLayout4); imgPanel.setLayout(gridBagLayout7); addButton.setBorder(null); addButton.setText("Start Calc"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { addButton_actionPerformed(e); } }); controlComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { controlComboBox_actionPerformed(e); } }); emailLabel.setText("Email:"); datasetLabel.setText("Dataset Id:"); emailText.setText(""); dataPanel.setMinimumSize(new Dimension(548, 150)); dataPanel.setPreferredSize(new Dimension(549, 150)); this.getContentPane().add(mainPanel, BorderLayout.CENTER); mainPanel.add(mainSplitPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 2, 3), 0, 431)); mainSplitPane.add(buttonPanel, JSplitPane.BOTTOM); buttonPanel.add(dataPanel, BorderLayout.CENTER); dataPanel.add(datasetIdText, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(34, 19, 81, 0), 162, 7)); dataPanel.add(datasetLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(34, 7, 81, 0), 28, 10)); dataPanel.add(emailText, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(43, 19, 0, 0), 162, 7)); dataPanel.add(controlComboBox, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(43, 48, 0, 24), 35, 2)); dataPanel.add(emailLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(43, 7, 0, 15), 43, 12)); dataPanel.add(addButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(27, 51, 81, 24), 79, 12)); buttonPanel.add(imgPanel, BorderLayout.SOUTH); imgPanel.add(imgLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 235, 3, 246), 57, 28)); mainSplitPane.add(parameterTabbedPanel, JSplitPane.TOP); imr_IMTSplit.add(imtPanel, JSplitPane.BOTTOM); imr_IMTSplit.add(imrSelectionPanel, JSplitPane.TOP); imrPanel.add(imr_IMTSplit, BorderLayout.CENTER); parameterTabbedPanel.addTab("Intensity-Measure Relationship", imrPanel); parameterTabbedPanel.addTab("Region & Site Params", gridRegionSitePanel); parameterTabbedPanel.addTab("Earthquake Rupture Forecast", eqkRupPanel); mainSplitPane.setDividerLocation(550); imr_IMTSplit.setDividerLocation(300); imgLabel.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { imgLabel_mouseClicked(e); } }); }
From source file:shuffle.fwk.service.roster.EditRosterService.java
private Component makeBottomPanel() { JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.insets = new Insets(0, 10, 0, 10); c.weightx = 1.0;//from w ww . j a v a 2 s. c om c.weighty = 0.0; c.gridx = 1; c.gridy = 1; c.gridwidth = 1; c.gridheight = 1; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.0; c.gridx++; selectedDisplayLabel = new JLabel(getString(KEY_NONE_SELECTED)); selectedDisplayLabel.setToolTipText(getString(KEY_SELECTED_TOOLTIP)); ; ret.add(selectedDisplayLabel, c); c.insets = new Insets(0, 0, 0, 0); c.anchor = GridBagConstraints.LINE_END; c.weightx = 1.0; c.gridx++; teamFilter = new JCheckBox(getString(KEY_TEAM)); JPanel teamFilterPanel = new JPanel(new BorderLayout()); teamFilterPanel.add(teamFilter, BorderLayout.WEST); teamFilter.setToolTipText(getString(KEY_TEAM_TOOLTIP)); ret.add(teamFilterPanel, c); c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.0; c.gridx++; activeEffect = new EffectChooser(false, EffectChooser.DefaultEntry.SPECIES); JPanel activeEffectPanel = new JPanel(new BorderLayout()); activeEffectPanel.add(activeEffect, BorderLayout.WEST); activeEffect.setToolTipText(getString(KEY_ACTIVE_EFFECT)); ret.add(activeEffectPanel, c); c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.0; c.gridx++; JPanel skillPanel = new JPanel(new BorderLayout()); ImageIcon skillBoosterIcon = getUser().getImageManager().getImageFor(KEY_SKILL_BOOSTER); JLabel skillBoosterLabel = new JLabel(skillBoosterIcon); skillPanel.add(skillBoosterLabel, BorderLayout.EAST); skillLevels = new JComboBox<Integer>(); skillLevels.setEnabled(false); skillLevels.addItem(1); skillPanel.add(skillLevels, BorderLayout.WEST); skillPanel.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP)); skillLevels.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP)); ret.add(skillPanel, c); c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.0; c.gridx++; JPanel speedupPanel = new JPanel(new BorderLayout()); ImageIcon candyIcon = getUser().getImageManager().getImageFor(KEY_CANDY_ICON); JLabel candyLabel = new JLabel(candyIcon); speedupPanel.add(candyLabel, BorderLayout.EAST); speedups = new JComboBox<Integer>(); speedups.setEnabled(false); speedups.addItem(0); speedupPanel.add(speedups, BorderLayout.WEST); speedupPanel.setToolTipText(getString(KEY_CANDY_TOOLTIP)); speedups.setToolTipText(getString(KEY_CANDY_TOOLTIP)); ret.add(speedupPanel, c); c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.0; c.gridx++; JButton okButton = new JButton(getString(KEY_OK)); okButton.setToolTipText(getString(KEY_OK_TOOLTIP)); ret.add(okButton, c); setDefaultButton(okButton); c.anchor = GridBagConstraints.CENTER; c.weightx = 0.0; c.gridx++; JButton applyButton = new JButton(getString(KEY_APPLY)); applyButton.setToolTipText(getString(KEY_APPLY_TOOLTIP)); ret.add(applyButton, c); c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.0; c.gridx++; JButton cancelButton = new JButton(new DisposeAction(getString(KEY_CANCEL), this)); cancelButton.setToolTipText(getString(KEY_CANCEL_TOOLTIP)); ret.add(cancelButton, c); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onOK(); } }); applyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onApply(); } }); addSpeedupsListener(); return ret; }
From source file:org.openconcerto.erp.core.humanresources.payroll.element.FichePayeSQLElement.java
public SQLComponent createComponent() { return new BaseSQLComponent(this) { private FichePayeModel model; private ElementComboBox comboSelProfil, selSalCombo; private EditFrame edit = null; private ElementComboBox selMois; private int dernMois, dernAnnee; private JTextField textAnnee; JDate dateDu, dateAu;//from w w w. j a v a 2s. c o m private JScrollPane paneTreeLeft; private JPanel pDate; private JButton buttonValider, buttonGenCompta; public void addViews() { this.dernMois = 0; this.dernAnnee = 0; this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); // Tree elt Fiche de Paye On the left c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.gridheight = GridBagConstraints.REMAINDER; final RubriquePayeTree tree = new RubriquePayeTree(); tree.expandRow(0); this.paneTreeLeft = new JScrollPane(tree); // this.add(this.paneTreeLeft, c); // Panel Fiche paye on the right // Salarie JPanel panelRight = new JPanel(); panelRight.setLayout(new GridBagLayout()); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.weighty = 0; c.gridheight = 1; c.gridwidth = 2; this.selSalCombo = new ElementComboBox(); // c.gridx++; panelRight.add(this.selSalCombo, c); // Mois c.gridy++; // c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.weighty = 0; c.gridheight = 1; c.gridwidth = 3; JLabel labelMois = new JLabel("Fiche de paye du mois de"); this.selMois = new ElementComboBox(true, 20); // this.selMois.setEditable(true); // /this.selMois.setEnabled(true); JLabel labelDu = new JLabel("Du"); JLabel labelAu = new JLabel("Au"); this.dateDu = new JDate(); this.dateAu = new JDate(); // JTextField textMois = new JTextField(); JLabel labelAnnee = new JLabel("Anne"); this.textAnnee = new JTextField(); { this.pDate = new JPanel(); this.pDate.setOpaque(false); this.pDate.add(labelMois); this.pDate.add(this.selMois); this.pDate.add(labelAnnee); this.pDate.add(this.textAnnee); this.pDate.add(labelDu); this.pDate.add(this.dateDu); this.pDate.add(labelAu); this.pDate.add(this.dateAu); panelRight.add(this.pDate, c); } c.gridx += 2; c.weightx = 1; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; panelRight.add(new JPanel(), c); // Action Button c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.weighty = 0; JPanel pButtons = new JPanel(); pButtons.setOpaque(false); JButton buttonUp = new JNiceButton(IListFrame.class.getResource("fleche_haut.png")); JButton buttonDown = new JNiceButton(IListFrame.class.getResource("fleche_bas.png")); JButton buttonRemove = new JNiceButton(SQLComponent.class.getResource("delete.png")); { pButtons.add(buttonUp); pButtons.add(buttonDown); pButtons.add(buttonRemove); } panelRight.add(pButtons, c); // Table c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.gridx = 1; c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; this.model = new FichePayeModel(1); final JTable table = new JTable(this.model); panelRight.add(new JScrollPane(table), c); FichePayeRenderer rend = new FichePayeRenderer(); table.setDefaultRenderer(String.class, rend); table.setDefaultRenderer(Float.class, rend); // Import profil c.gridx = 1; c.gridy++; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; JLabel labelProfil = new JLabel("Importer depuis un profil prdfini"); panelRight.add(labelProfil, c); c.gridwidth = 1; this.comboSelProfil = new ElementComboBox(); // this.comboSelProfil = new ElementComboBox(); this.comboSelProfil.setListIconVisible(false); c.gridx++; c.gridwidth = 1; // this.comboSelProfil.init(eltProfil.getTable().getField("NOM"), null); panelRight.add(this.comboSelProfil, c); JButton buttonImportProfil = new JButton("Importer"); c.gridx++; panelRight.add(buttonImportProfil, c); // Total Periode JPanel panelTotal = new JPanel(); panelTotal.setBorder(BorderFactory.createTitledBorder("Total priode")); panelTotal.setLayout(new GridBagLayout()); GridBagConstraints cPanel = new DefaultGridBagConstraints(); // Salaire brut JLabel labelBrut = new JLabel(getLabelFor("SAL_BRUT")); panelTotal.add(labelBrut, cPanel); JTextField textSalBrut = new JTextField(10); cPanel.gridx++; cPanel.weightx = 0; panelTotal.add(textSalBrut, cPanel); textSalBrut.setEditable(false); textSalBrut.setEnabled(false); // acompte cPanel.gridx++; JLabel labelAcompte = new JLabel(getLabelFor("ACOMPTE")); panelTotal.add(labelAcompte, cPanel); JTextField textAcompte = new JTextField(10); cPanel.gridx++; panelTotal.add(textAcompte, cPanel); // textAcompte.setEditable(false); // textAcompte.setEnabled(false); // Conges Acquis cPanel.gridx++; JLabel labelCongesAcquis = new JLabel(getLabelFor("CONGES_ACQUIS")); panelTotal.add(labelCongesAcquis, cPanel); JTextField textCongesAcquis = new JTextField(10); cPanel.gridx++; panelTotal.add(textCongesAcquis, cPanel); // cotisation salariale cPanel.gridx = 0; cPanel.gridy++; JLabel labelCotSal = new JLabel(getLabelFor("COT_SAL")); panelTotal.add(labelCotSal, cPanel); JTextField textCotSal = new JTextField(10); cPanel.gridx++; panelTotal.add(textCotSal, cPanel); textCotSal.setEditable(false); textCotSal.setEnabled(false); // cotisation patronale cPanel.gridx++; JLabel labelCotPat = new JLabel(getLabelFor("COT_PAT")); panelTotal.add(labelCotPat, cPanel); JTextField textCotPat = new JTextField(10); cPanel.gridx++; panelTotal.add(textCotPat, cPanel); textCotPat.setEditable(false); textCotPat.setEnabled(false); JLabel labelCSG = new JLabel(getLabelFor("CSG")); cPanel.gridx++; panelTotal.add(labelCSG, cPanel); JTextField textCSG = new JTextField(10); cPanel.gridx++; panelTotal.add(textCSG, cPanel); textCSG.setEditable(false); textCSG.setEnabled(false); // net imposable cPanel.gridx = 0; cPanel.gridy++; JLabel labelNetImp = new JLabel(getLabelFor("NET_IMP")); panelTotal.add(labelNetImp, cPanel); JTextField textNetImp = new JTextField(10); cPanel.gridx++; panelTotal.add(textNetImp, cPanel); textNetImp.setEditable(false); textNetImp.setEnabled(false); cPanel.gridx++; JLabel labelNetAPayer = new JLabel(getLabelFor("NET_A_PAYER")); panelTotal.add(labelNetAPayer, cPanel); JTextField textNetAPayer = new JTextField(10); cPanel.gridx++; panelTotal.add(textNetAPayer, cPanel); textNetAPayer.setEditable(false); textNetAPayer.setEnabled(false); c.gridx = 1; c.gridy++; c.gridwidth = GridBagConstraints.REMAINDER; panelRight.add(panelTotal, c); // Cumuls c.gridx = 1; c.gridy++; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; this.buttonValider = new JButton("Valider"); // panelRight.add(buttonValider, c); c.gridx++; c.gridwidth = 1; this.buttonGenCompta = new JButton("Generer la comptabilit"); // panelRight.add(buttonGenCompta, c); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; this.add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.paneTreeLeft, panelRight), c); // Listeners this.buttonGenCompta.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int[] i = new int[1]; i[0] = getSelectedID(); SQLRow rowMois = getTable().getBase().getTable("MOIS").getRow(selMois.getSelectedId()); new GenerationMvtFichePaye(i, rowMois.getString("NOM"), textAnnee.getText()); } }); this.buttonValider.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.err.println("Validation de la fiche de paye"); validationFiche(); } }); buttonUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int newRowSelected = model.upRow(table.getSelectedRow()); if (newRowSelected >= 0) { table.setRowSelectionInterval(newRowSelected, newRowSelected); } } }); buttonDown.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int newRowSelected = model.downRow(table.getSelectedRow()); if (newRowSelected >= 0) { table.setRowSelectionInterval(newRowSelected, newRowSelected); } } }); buttonRemove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { model.removeRow(table.getSelectedRow()); } }); tree.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent mE) { TreePath path = tree.getClosestPathForLocation(mE.getPoint().x, mE.getPoint().y); final Object obj = path.getLastPathComponent(); if (obj == null) { return; } if (mE.getClickCount() == 2 && mE.getButton() == MouseEvent.BUTTON1) { if (obj instanceof VariableRowTreeNode) { model.addRowAt(((VariableRowTreeNode) obj).getRow(), table.getSelectedRow()); } } else { if (mE.getButton() == 3) { if (obj instanceof VariableRowTreeNode) { final SQLRow row = ((VariableRowTreeNode) obj).getRow(); JPopupMenu menuDroit = new JPopupMenu(); menuDroit.add(new AbstractAction("Editer") { public void actionPerformed(ActionEvent e) { if (edit != null) { edit.dispose(); } edit = new EditFrame(Configuration.getInstance().getDirectory() .getElement(row.getTable()), EditFrame.MODIFICATION); edit.selectionId(row.getID(), 0); edit.pack(); edit.setVisible(true); } }); menuDroit.add(new AbstractAction("Nouvelle rubrique") { public void actionPerformed(ActionEvent e) { if (edit != null) { edit.dispose(); } edit = new EditFrame(Configuration.getInstance().getDirectory() .getElement(row.getTable())); edit.pack(); edit.setVisible(true); } }); menuDroit.show(mE.getComponent(), mE.getPoint().x, mE.getPoint().y); } } } } }); this.dateDu.addValueListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (!dateDu.isEmpty()) { Date d = dateDu.getValue(); if (d != null) { Calendar cal = Calendar.getInstance(); cal.setTime(d); if (selMois.getSelectedId() > 1 && cal.get(Calendar.MONTH) + 2 != selMois.getSelectedId()) { cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.MONTH, selMois.getSelectedId() - 2); System.err.println("Du " + cal.getTime()); dateDu.setValue(cal.getTime()); } } } } }); this.dateAu.addValueListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (!dateAu.isEmpty()) { Date d = dateAu.getValue(); if (d != null) { Calendar cal = Calendar.getInstance(); cal.setTime(d); if (selMois.getSelectedId() > 1 && cal.get(Calendar.MONTH) + 2 != selMois.getSelectedId()) { // TODO checker l'annee // TODO ajouter dans le isValidated du au compris dans le mois // selectionne // Calendar.getInstance().set(Calendar.DAY_OF_MONTH, maxDay); cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.MONTH, selMois.getSelectedId() - 2); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); System.err.println("Au " + cal.getTime()); dateAu.setValue(cal.getTime()); } } } } }); this.addRequiredSQLObject(this.textAnnee, "ANNEE"); this.addRequiredSQLObject(this.selMois, "ID_MOIS"); this.addSQLObject(this.comboSelProfil, "ID_PROFIL_PAYE"); this.addSQLObject(textCongesAcquis, "CONGES_ACQUIS"); this.addSQLObject(textCotPat, "COT_PAT"); this.addSQLObject(textCotSal, "COT_SAL"); this.addSQLObject(textCSG, "CSG"); this.addSQLObject(textNetAPayer, "NET_A_PAYER"); this.addSQLObject(textNetImp, "NET_IMP"); this.addSQLObject(textSalBrut, "SAL_BRUT"); this.addSQLObject(textAcompte, "ACOMPTE"); this.addSQLObject(this.selSalCombo, "ID_SALARIE"); this.addRequiredSQLObject(this.dateDu, "DU"); this.addRequiredSQLObject(this.dateAu, "AU"); this.selSalCombo.setEditable(false); this.selSalCombo.setEnabled(false); this.selSalCombo.setButtonsVisible(false); // this.selSalCombo.setVisible(false); buttonImportProfil.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { model.loadFromProfil(comboSelProfil.getSelectedId()); } }); } private boolean isDateValid() { String yearS = this.textAnnee.getText().trim(); int annee = (yearS.length() == 0) ? 0 : Integer.parseInt(yearS); int mois = this.selMois.getSelectedId(); // System.err.println("anne " + annee + " dernAnnee " + this.dernAnnee + " mois " + // mois + " dernMois " + this.dernMois); return ((this.dernAnnee == 0) ? true : annee > this.dernAnnee) || ((this.dernMois == 0 || this.dernMois == 13) ? true : mois > this.dernMois); } @Override public synchronized ValidState getValidState() { // FIXME add fireValidChange() return super.getValidState().and(ValidState.createCached(isDateValid(), "Date invalide")); } public int insert(SQLRow order) { int id = super.insert(order); this.model.updateFields(id); return id; } @Override public void update() { super.update(); this.model.updateFields(this.getSelectedID()); } @Override public void select(SQLRowAccessor r) { // System.err.println("SELECT FICHE ID -> " + r.getID()); super.select(r); if (r != null && r.getID() > 1) { this.model.setFicheID(r.getID()); SQLTable tableSal = getTable().getBase().getTable("SALARIE"); SQLRow rowSal = tableSal.getRow(r.getInt("ID_SALARIE")); this.dernMois = rowSal.getInt("DERNIER_MOIS"); this.dernAnnee = rowSal.getInt("DERNIERE_ANNEE"); this.selSalCombo.setVisible(((Boolean) r.getObject("VALIDE")).booleanValue()); this.paneTreeLeft.setVisible(!((Boolean) r.getObject("VALIDE")).booleanValue()); this.buttonValider.setVisible(!((Boolean) r.getObject("VALIDE")).booleanValue()); setpDateEnabled(!((Boolean) r.getObject("VALIDE")).booleanValue()); } this.selSalCombo.setEditable(false); this.selSalCombo.setEnabled(false); this.selMois.setButtonsVisible(false); this.selSalCombo.setButtonsVisible(false); } private void setpDateEnabled(boolean b) { // System.err.println("Set date enable --> " + b); this.selMois.setEditable(b); // this.selMois.setEnabled(b); this.textAnnee.setEditable(b); this.textAnnee.setEnabled(b); this.dateDu.setEditable(b); this.dateDu.setEnabled(b); this.dateAu.setEditable(b); this.dateAu.setEnabled(b); } private void validationFiche() { this.update(); FichePayeSQLElement.validationFiche(this.getSelectedID()); } protected SQLRowValues createDefaults() { System.err.println("**********Set Defaults on FichePaye.date"); SQLRowValues rowVals = new SQLRowValues(getTable()); Calendar cal = Calendar.getInstance(); rowVals.put("ID_MOIS", cal.get(Calendar.MONTH) + 2); rowVals.put("ANNEE", cal.get(Calendar.YEAR)); cal.set(Calendar.DAY_OF_MONTH, 1); rowVals.put("DU", new java.sql.Date(cal.getTime().getTime())); cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); rowVals.put("AU", new java.sql.Date(cal.getTime().getTime())); return rowVals; } }; }