public void addRow(String label, JComponent component) { GridBagConstraints labelConstraints = new GridBagConstraints(); labelConstraints.gridx = 0; labelConstraints.gridy = rowCount; labelConstraints.insets = new Insets(0, 0, 5, 5); labelConstraints.anchor = GridBagConstraints.LINE_END; GridBagConstraints componentConstraints = new GridBagConstraints(); componentConstraints.gridx = 1; componentConstraints.gridy = rowCount; componentConstraints.gridwidth = GridBagConstraints.REMAINDER; componentConstraints.fill = GridBagConstraints.HORIZONTAL; componentConstraints.insets = new Insets(0, 0, 5, 0); componentConstraints.anchor = GridBagConstraints.LINE_START; JLabel l = new JLabel(label + ":"); add(l, labelConstraints); add(component, componentConstraints); rowCount++; // Add another column/row that takes up all available space. // This moves the layout to the top-left corner. layout.columnWidths = new int[] {0, 0, 0}; layout.columnWeights = new double[] {0.0, 0.0, 1.0E-4}; layout.rowHeights = new int[rowCount + 1]; layout.rowWeights = new double[rowCount + 1]; layout.rowWeights[rowCount] = 1.0E-4; }
public ManageBankView() { GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] {0, 0, 0, 0, 0}; gridBagLayout.rowHeights = new int[] {0, 0, 0, 0, 0}; gridBagLayout.columnWeights = new double[] {0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; getContentPane().setLayout(gridBagLayout); JLabel lblEnterBank = new JLabel("Enter Bank"); GridBagConstraints gbc_lblEnterBank = new GridBagConstraints(); gbc_lblEnterBank.insets = new Insets(0, 0, 5, 5); gbc_lblEnterBank.gridx = 1; gbc_lblEnterBank.gridy = 1; getContentPane().add(lblEnterBank, gbc_lblEnterBank); txtBankName = new JTextField(); GridBagConstraints gbc_txtBankName = new GridBagConstraints(); gbc_txtBankName.insets = new Insets(0, 0, 5, 0); gbc_txtBankName.fill = GridBagConstraints.HORIZONTAL; gbc_txtBankName.gridx = 3; gbc_txtBankName.gridy = 1; getContentPane().add(txtBankName, gbc_txtBankName); txtBankName.setColumns(10); JButton btnAdd = new JButton("Add"); GridBagConstraints gbc_btnAdd = new GridBagConstraints(); gbc_btnAdd.insets = new Insets(0, 0, 0, 5); gbc_btnAdd.gridx = 1; gbc_btnAdd.gridy = 3; getContentPane().add(btnAdd, gbc_btnAdd); }
public NNNoGoodPartsPanel(LaneManager app) { this.app = app; GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] {61, 138, 117, 0}; gridBagLayout.rowHeights = new int[] {16, 0, 27, 29, 0, 0, 0}; gridBagLayout.columnWeights = new double[] {0.0, 1.0, 0.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; setLayout(gridBagLayout); JLabel lblNewLabel = new JLabel("No good parts in nest #"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.anchor = GridBagConstraints.EAST; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 0; add(lblNewLabel, gbc_lblNewLabel); noGoodPartsComboBox = new JComboBox(); noGoodPartsComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_comboBox = new GridBagConstraints(); gbc_comboBox.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox.insets = new Insets(0, 0, 5, 5); gbc_comboBox.gridx = 1; gbc_comboBox.gridy = 0; add(noGoodPartsComboBox, gbc_comboBox); noPartsSubmitButton = new JButton("Submit"); GridBagConstraints gbc_btnNewButton = new GridBagConstraints(); gbc_btnNewButton.insets = new Insets(0, 0, 5, 0); gbc_btnNewButton.gridx = 2; gbc_btnNewButton.gridy = 0; add(noPartsSubmitButton, gbc_btnNewButton); JLabel lblNewLabel_1 = new JLabel("Parts unstable in nest #"); GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints(); gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_1.gridx = 0; gbc_lblNewLabel_1.gridy = 1; add(lblNewLabel_1, gbc_lblNewLabel_1); partsUnstableComboBox = new JComboBox(); partsUnstableComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_comboBox_1 = new GridBagConstraints(); gbc_comboBox_1.insets = new Insets(0, 0, 5, 5); gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_1.gridx = 1; gbc_comboBox_1.gridy = 1; add(partsUnstableComboBox, gbc_comboBox_1); partsUnstableSubmitButton = new JButton("Submit"); GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints(); gbc_btnNewButton_1.insets = new Insets(0, 0, 5, 0); gbc_btnNewButton_1.gridx = 2; gbc_btnNewButton_1.gridy = 1; add(partsUnstableSubmitButton, gbc_btnNewButton_1); JLabel lblNewLabel_2 = new JLabel("Robot in way of nest #"); GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints(); gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_2.gridx = 0; gbc_lblNewLabel_2.gridy = 2; add(lblNewLabel_2, gbc_lblNewLabel_2); partsRobotComboBox = new JComboBox(); partsRobotComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_parts_comboBox = new GridBagConstraints(); gbc_parts_comboBox.insets = new Insets(0, 0, 5, 5); gbc_parts_comboBox.fill = GridBagConstraints.HORIZONTAL; gbc_parts_comboBox.gridx = 1; gbc_parts_comboBox.gridy = 2; add(partsRobotComboBox, gbc_parts_comboBox); partsRobotSubmitButton = new JButton("Submit"); GridBagConstraints gbc_button = new GridBagConstraints(); gbc_button.insets = new Insets(0, 0, 5, 0); gbc_button.gridx = 2; gbc_button.gridy = 2; add(partsRobotSubmitButton, gbc_button); JLabel lblNewLabel_3 = new JLabel("Parts Pile Up in Nest #"); GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints(); gbc_lblNewLabel_3.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_3.gridx = 0; gbc_lblNewLabel_3.gridy = 3; add(lblNewLabel_3, gbc_lblNewLabel_3); partsPileUpComboBox = new JComboBox(); partsPileUpComboBox.setModel( new DefaultComboBoxModel(new String[] {"0", "1", "2", "3", "4", "5", "6", "7"})); GridBagConstraints gbc_pileUp_comboBox = new GridBagConstraints(); gbc_pileUp_comboBox.insets = new Insets(0, 0, 5, 5); gbc_pileUp_comboBox.fill = GridBagConstraints.HORIZONTAL; gbc_pileUp_comboBox.gridx = 1; gbc_pileUp_comboBox.gridy = 3; add(partsPileUpComboBox, gbc_pileUp_comboBox); partsPileUpSubmitButton = new JButton("Submit"); GridBagConstraints gbc_pileUp = new GridBagConstraints(); gbc_pileUp.insets = new Insets(0, 0, 5, 0); gbc_pileUp.gridx = 2; gbc_pileUp.gridy = 3; add(partsPileUpSubmitButton, gbc_pileUp); noPartsSubmitButton.addActionListener(this); partsUnstableSubmitButton.addActionListener(this); partsRobotSubmitButton.addActionListener(this); partsPileUpSubmitButton.addActionListener(this); }
/** * Create the panel. */ public RacunovodstvoSpaseniObracuniJPanel() { setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Spašeni obračuni:", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0, 0}; gridBagLayout.rowHeights = new int[]{0, 0, 0, 0}; gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[]{0.0, 1.0, 0.0, Double.MIN_VALUE}; setLayout(gridBagLayout); JPanel obracunZaJPanel = new JPanel(); GridBagConstraints gbc_obracunZaJPanel = new GridBagConstraints(); gbc_obracunZaJPanel.insets = new Insets(0, 0, 5, 0); gbc_obracunZaJPanel.fill = GridBagConstraints.HORIZONTAL; gbc_obracunZaJPanel.gridx = 0; gbc_obracunZaJPanel.gridy = 0; add(obracunZaJPanel, gbc_obracunZaJPanel); GridBagLayout gbl_obracunZaJPanel = new GridBagLayout(); gbl_obracunZaJPanel.columnWidths = new int[]{46, 392, 0}; gbl_obracunZaJPanel.rowHeights = new int[]{141, 0}; gbl_obracunZaJPanel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE}; gbl_obracunZaJPanel.rowWeights = new double[]{0.0, Double.MIN_VALUE}; obracunZaJPanel.setLayout(gbl_obracunZaJPanel); JLabel obracunZaJLabel = new JLabel("Obračun za:"); obracunZaJLabel.setHorizontalAlignment(SwingConstants.TRAILING); GridBagConstraints gbc_obracunZaJLabel = new GridBagConstraints(); gbc_obracunZaJLabel.fill = GridBagConstraints.BOTH; gbc_obracunZaJLabel.insets = new Insets(0, 0, 0, 5); gbc_obracunZaJLabel.gridx = 0; gbc_obracunZaJLabel.gridy = 0; obracunZaJPanel.add(obracunZaJLabel, gbc_obracunZaJLabel); obracunZaJComboBox = new JComboBox(); GridBagConstraints gbc_obracunZaJComboBox = new GridBagConstraints(); gbc_obracunZaJComboBox.fill = GridBagConstraints.HORIZONTAL; gbc_obracunZaJComboBox.gridx = 1; gbc_obracunZaJComboBox.gridy = 0; obracunZaJPanel.add(obracunZaJComboBox, gbc_obracunZaJComboBox); JPanel podaciOObracunimaJPanel = new JPanel(); podaciOObracunimaJPanel.setBorder(null); GridBagConstraints gbc_podaciOObracunimaJPanel = new GridBagConstraints(); gbc_podaciOObracunimaJPanel.insets = new Insets(0, 0, 5, 0); gbc_podaciOObracunimaJPanel.fill = GridBagConstraints.BOTH; gbc_podaciOObracunimaJPanel.gridx = 0; gbc_podaciOObracunimaJPanel.gridy = 1; add(podaciOObracunimaJPanel, gbc_podaciOObracunimaJPanel); GridBagLayout gbl_podaciOObracunimaJPanel = new GridBagLayout(); gbl_podaciOObracunimaJPanel.columnWidths = new int[]{0, 0, 0}; gbl_podaciOObracunimaJPanel.rowHeights = new int[]{245, 0}; gbl_podaciOObracunimaJPanel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE}; gbl_podaciOObracunimaJPanel.rowWeights = new double[]{1.0, Double.MIN_VALUE}; podaciOObracunimaJPanel.setLayout(gbl_podaciOObracunimaJPanel); JLabel obracuniJLabel = new JLabel("Obračuni:"); obracuniJLabel.setHorizontalAlignment(SwingConstants.RIGHT); GridBagConstraints gbc_obracuniJLabel = new GridBagConstraints(); gbc_obracuniJLabel.anchor = GridBagConstraints.EAST; gbc_obracuniJLabel.insets = new Insets(0, 0, 0, 5); gbc_obracuniJLabel.gridx = 0; gbc_obracuniJLabel.gridy = 0; podaciOObracunimaJPanel.add(obracuniJLabel, gbc_obracuniJLabel); JScrollPane obracuniJScrollPane = new JScrollPane(); GridBagConstraints gbc_obracuniJScrollPane = new GridBagConstraints(); gbc_obracuniJScrollPane.fill = GridBagConstraints.BOTH; gbc_obracuniJScrollPane.gridx = 1; gbc_obracuniJScrollPane.gridy = 0; podaciOObracunimaJPanel.add(obracuniJScrollPane, gbc_obracuniJScrollPane); obracuniJTable = new JTable(); obracuniJTable.setModel(new DefaultTableModel( new Object[][]{ }, new String[]{ "Datum", "Broj", "Iznos", "Plaćen", "Obračunao", "Početak obračuna", "Kraj obračuna" } ) { Class[] columnTypes = new Class[]{ Object.class, Object.class, Object.class, Boolean.class, Object.class, Object.class, Object.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); obracuniJScrollPane.setViewportView(obracuniJTable); JPanel dugmadJPanel = new JPanel(); GridBagConstraints gbc_dugmadJPanel = new GridBagConstraints(); gbc_dugmadJPanel.fill = GridBagConstraints.BOTH; gbc_dugmadJPanel.gridx = 0; gbc_dugmadJPanel.gridy = 2; add(dugmadJPanel, gbc_dugmadJPanel); GridBagLayout gbl_dugmadJPanel = new GridBagLayout(); gbl_dugmadJPanel.columnWidths = new int[]{0, 0, 0}; gbl_dugmadJPanel.rowHeights = new int[]{0, 0, 0}; gbl_dugmadJPanel.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE}; gbl_dugmadJPanel.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE}; dugmadJPanel.setLayout(gbl_dugmadJPanel); obrisiObracunJButton = new JButton("Obriši obračun"); GridBagConstraints gbc_obrisiObracunJButton = new GridBagConstraints(); gbc_obrisiObracunJButton.anchor = GridBagConstraints.SOUTH; gbc_obrisiObracunJButton.fill = GridBagConstraints.HORIZONTAL; gbc_obrisiObracunJButton.insets = new Insets(0, 0, 5, 5); gbc_obrisiObracunJButton.gridx = 0; gbc_obrisiObracunJButton.gridy = 0; dugmadJPanel.add(obrisiObracunJButton, gbc_obrisiObracunJButton); kreirajPdfJButton = new JButton("Kreiraj PDF"); GridBagConstraints gbc_kreirajPdfJButton = new GridBagConstraints(); gbc_kreirajPdfJButton.insets = new Insets(0, 0, 5, 0); gbc_kreirajPdfJButton.anchor = GridBagConstraints.SOUTH; gbc_kreirajPdfJButton.fill = GridBagConstraints.HORIZONTAL; gbc_kreirajPdfJButton.gridx = 1; gbc_kreirajPdfJButton.gridy = 0; dugmadJPanel.add(kreirajPdfJButton, gbc_kreirajPdfJButton); dodajListeners(); }
private void init() { input = new JTextField[nInputs]; double[] rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; rowWeights[nInputs + 2] = 1.0; GridBagLayout gbl_functionPanel = new GridBagLayout(); gbl_functionPanel.columnWidths = new int[] {5, 0, 50, 50, 30, 25, 5, 0}; gbl_functionPanel.rowHeights = new int[] {10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10}; gbl_functionPanel.columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_functionPanel.rowWeights = rowWeights; this.setLayout(gbl_functionPanel); // Function input field. for (int i = 0; i < nInputs; i++) { // Creation. input[i] = new JTextField(); GridBagConstraints gbc_stdFuncInput = new GridBagConstraints(); gbc_stdFuncInput.gridwidth = 4; gbc_stdFuncInput.insets = new Insets(0, 0, 5, 5); gbc_stdFuncInput.fill = GridBagConstraints.HORIZONTAL; gbc_stdFuncInput.anchor = GridBagConstraints.NORTH; gbc_stdFuncInput.gridx = 2; gbc_stdFuncInput.gridy = i + 1; // Setup. GuiUtil.setupUndoListener(input[i]); setupInputListeners(input[i]); this.add(input[i], gbc_stdFuncInput); } // Labels for the input fields String[] labelNames = labelNames(); for (int i = 0; i < labelNames.length; i++) { GridBagConstraints gbc_FuncLabel = new GridBagConstraints(); gbc_FuncLabel.gridwidth = 1; gbc_FuncLabel.insets = new Insets(0, 0, 5, 5); gbc_FuncLabel.fill = GridBagConstraints.HORIZONTAL; gbc_FuncLabel.anchor = GridBagConstraints.CENTER; gbc_FuncLabel.gridx = 1; gbc_FuncLabel.gridy = i + 1; JLabel label = new JLabel(labelNames[i]); this.add(label, gbc_FuncLabel); } // OptionPanel. mainOP = new JPanel(); mainOP.setBorder(BorderFactory.createEtchedBorder()); GridBagConstraints gbc_mainOP = new GridBagConstraints(); gbc_mainOP.fill = GridBagConstraints.BOTH; gbc_mainOP.gridwidth = 5; gbc_mainOP.insets = new Insets(0, 0, 5, 5); gbc_mainOP.gridx = 1; gbc_mainOP.gridy = nInputs + 1; this.add(mainOP, gbc_mainOP); gridOP = getGridOptionPanel(); gridOP.addFunctionListener(createGridOptionPanelListener()); apperanceOP = new AppearanceOptionPanel(colorList, map); mainOP.setLayout(new BoxLayout(mainOP, BoxLayout.Y_AXIS)); mainOP.add((Component) gridOP); mainOP.add(apperanceOP); // The standard function list outerFuncTab = new JPanel(); funcPanelWrapper = new JScrollPane(outerFuncTab); funcPanelWrapper.setBorder(BorderFactory.createEtchedBorder()); funcPanelWrapper.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); funcPanelWrapper.setMinimumSize(new Dimension(310, 500)); GridBagConstraints gbc_funcPanelWrapper = new GridBagConstraints(); gbc_funcPanelWrapper.fill = GridBagConstraints.BOTH; gbc_funcPanelWrapper.gridwidth = 5; gbc_funcPanelWrapper.insets = new Insets(0, 0, 5, 5); gbc_funcPanelWrapper.gridx = 1; gbc_funcPanelWrapper.gridy = nInputs + 2; ; this.add(funcPanelWrapper, gbc_funcPanelWrapper); GridBagLayout gbl_stdFuncPanel = new GridBagLayout(); gbl_stdFuncPanel.columnWidths = new int[] {0, 0}; gbl_stdFuncPanel.rowHeights = new int[] {0, 0}; gbl_stdFuncPanel.columnWeights = new double[] {1.0, Double.MIN_VALUE}; gbl_stdFuncPanel.rowWeights = new double[] {1.0, Double.MIN_VALUE}; outerFuncTab.setLayout(gbl_stdFuncPanel); innerFuncTab = new JPanel(); GridBagConstraints gbc_innerFuncPanel = new GridBagConstraints(); gbc_innerFuncPanel.anchor = GridBagConstraints.NORTH; gbc_innerFuncPanel.fill = GridBagConstraints.HORIZONTAL; gbc_innerFuncPanel.gridx = 0; gbc_innerFuncPanel.gridy = 0; outerFuncTab.add(innerFuncTab, gbc_innerFuncPanel); innerFuncTab.setLayout(new BoxLayout(innerFuncTab, BoxLayout.Y_AXIS)); }
/** Initialize the contents of the frame. */ private void initialize() { frame = new JFrame("SkAppA"); frame.setBounds(100, 100, 750, 400); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /* */ ImageIcon imIcon = new ImageIcon(this.getClass().getClassLoader().getResource("res/logo.png")); // ImageIcon imIcon = new ImageIcon("C:\\Users\\davem\\workspace\\Skappa\\res\\logo.png"); Image image = imIcon.getImage(); Image newImage = image.getScaledInstance(120, 120, Image.SCALE_SMOOTH); imIcon = new ImageIcon(newImage); frame.getContentPane().setLayout(new CardLayout(0, 0)); panelIniziale = new JPanel(); frame.getContentPane().add(panelIniziale, "name_10245570710976"); panelIniziale.setLayout(new BorderLayout(0, 0)); JPanel panel = new JPanel(); panelIniziale.add(panel, BorderLayout.SOUTH); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JPanel panelInviaMail = new JPanel(); frame.getContentPane().add(panelInviaMail, "name_74765522122111"); frame.setBounds(100, 100, 750, 400); panelInviaMail.setLayout(new BorderLayout(0, 0)); JPanel panel_6 = new JPanel(); panelInviaMail.add(panel_6, BorderLayout.CENTER); GridBagLayout gbl_panel_6 = new GridBagLayout(); gbl_panel_6.columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; gbl_panel_6.rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; gbl_panel_6.columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_panel_6.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; panel_6.setLayout(gbl_panel_6); JLabel lblIndirizzoEmail = new JLabel("Indirizzo email"); GridBagConstraints gbc_lblIndirizzoEmail = new GridBagConstraints(); gbc_lblIndirizzoEmail.insets = new Insets(0, 0, 5, 5); gbc_lblIndirizzoEmail.gridx = 3; gbc_lblIndirizzoEmail.gridy = 1; panel_6.add(lblIndirizzoEmail, gbc_lblIndirizzoEmail); textFieldEmail = new JTextField(); GridBagConstraints gbc_textFieldEmail = new GridBagConstraints(); gbc_textFieldEmail.insets = new Insets(0, 0, 5, 5); gbc_textFieldEmail.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldEmail.gridx = 5; gbc_textFieldEmail.gridy = 1; panel_6.add(textFieldEmail, gbc_textFieldEmail); textFieldEmail.setColumns(10); JLabel lblUsername = new JLabel("Username"); GridBagConstraints gbc_lblUsername = new GridBagConstraints(); gbc_lblUsername.insets = new Insets(0, 0, 5, 5); gbc_lblUsername.gridx = 3; gbc_lblUsername.gridy = 3; panel_6.add(lblUsername, gbc_lblUsername); textFieldUsername = new JTextField(); GridBagConstraints gbc_textFieldUsername = new GridBagConstraints(); gbc_textFieldUsername.insets = new Insets(0, 0, 5, 5); gbc_textFieldUsername.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldUsername.gridx = 5; gbc_textFieldUsername.gridy = 3; panel_6.add(textFieldUsername, gbc_textFieldUsername); textFieldUsername.setColumns(10); JLabel lblPassword = new JLabel("Password"); GridBagConstraints gbc_lblPassword = new GridBagConstraints(); gbc_lblPassword.insets = new Insets(0, 0, 5, 5); gbc_lblPassword.gridx = 3; gbc_lblPassword.gridy = 5; panel_6.add(lblPassword, gbc_lblPassword); passwordField = new JPasswordField(); GridBagConstraints gbc_passwordField = new GridBagConstraints(); gbc_passwordField.insets = new Insets(0, 0, 5, 5); gbc_passwordField.fill = GridBagConstraints.HORIZONTAL; gbc_passwordField.gridx = 5; gbc_passwordField.gridy = 5; panel_6.add(passwordField, gbc_passwordField); JLabel lblIndirizzoServerSmtp = new JLabel("Indirizzo server smtp"); GridBagConstraints gbc_lblIndirizzoServerSmtp = new GridBagConstraints(); gbc_lblIndirizzoServerSmtp.insets = new Insets(0, 0, 5, 5); gbc_lblIndirizzoServerSmtp.gridx = 3; gbc_lblIndirizzoServerSmtp.gridy = 7; panel_6.add(lblIndirizzoServerSmtp, gbc_lblIndirizzoServerSmtp); textFieldSMTP = new JTextField(); GridBagConstraints gbc_textFieldSMTP = new GridBagConstraints(); gbc_textFieldSMTP.insets = new Insets(0, 0, 5, 5); gbc_textFieldSMTP.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldSMTP.gridx = 5; gbc_textFieldSMTP.gridy = 7; panel_6.add(textFieldSMTP, gbc_textFieldSMTP); textFieldSMTP.setColumns(10); JLabel lblPortaServerSmtp = new JLabel("Porta server smtp"); GridBagConstraints gbc_lblPortaServerSmtp = new GridBagConstraints(); gbc_lblPortaServerSmtp.insets = new Insets(0, 0, 5, 5); gbc_lblPortaServerSmtp.gridx = 3; gbc_lblPortaServerSmtp.gridy = 9; panel_6.add(lblPortaServerSmtp, gbc_lblPortaServerSmtp); textFieldSMTPPort = new JTextField(); GridBagConstraints gbc_textFieldSMTPPort = new GridBagConstraints(); gbc_textFieldSMTPPort.insets = new Insets(0, 0, 5, 5); gbc_textFieldSMTPPort.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldSMTPPort.gridx = 5; gbc_textFieldSMTPPort.gridy = 9; panel_6.add(textFieldSMTPPort, gbc_textFieldSMTPPort); textFieldSMTPPort.setColumns(10); progressBar = new JProgressBar(); GridBagConstraints gbc_progressBar = new GridBagConstraints(); gbc_progressBar.fill = GridBagConstraints.HORIZONTAL; gbc_progressBar.insets = new Insets(0, 0, 5, 5); gbc_progressBar.gridx = 5; gbc_progressBar.gridy = 11; panel_6.add(progressBar, gbc_progressBar); progressBar.setVisible(false); JPanel panel_7 = new JPanel(); panelInviaMail.add(panel_7, BorderLayout.NORTH); JLabel lblInserisciCredenziali = new JLabel("Inserisci credenziali"); lblInserisciCredenziali.setFont(new Font("Tahoma", Font.PLAIN, 18)); panel_7.add(lblInserisciCredenziali); JPanel panel_8 = new JPanel(); panelInviaMail.add(panel_8, BorderLayout.SOUTH); btnNewButton_5 = new JButton("Invia"); btnNewButton_5.setPreferredSize(new Dimension(70, 25)); btnNewButton_5.addActionListener(this); panel_8.add(btnNewButton_5); JButton btnNewButton_6 = new JButton("Annulla"); btnNewButton_6.setPreferredSize(new Dimension(70, 25)); btnNewButton_6.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { panelInviaMail.setVisible(false); panelCreaEvento.setVisible(true); frame.setBounds(100, 100, 750, 400); } }); panel_8.add(btnNewButton_6); JButton btnNewButton = new JButton("Crea evento"); btnNewButton.setPreferredSize(new Dimension(150, 30)); btnNewButton.setMinimumSize(new Dimension(150, 30)); btnNewButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panelCreaEvento.setVisible(true); panelIniziale.setVisible(false); // frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setBounds(100, 100, 750, 400); } }); panel.add(btnNewButton); JButton btnNewButton_1 = new JButton("Carica partecipanti"); btnNewButton_1.setPreferredSize(new Dimension(150, 30)); btnNewButton_1.setMinimumSize(new Dimension(150, 30)); btnNewButton_1.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panelCaricaPartecipanti.setVisible(true); panelIniziale.setVisible(false); } }); panel.add(btnNewButton_1); JPanel panel_1 = new JPanel(); panelIniziale.add(panel_1, BorderLayout.CENTER); SimpleAttributeSet attribs = new SimpleAttributeSet(); StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_CENTER); JTextPane txtpnSelezionaLaModalit = new JTextPane(); txtpnSelezionaLaModalit.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); txtpnSelezionaLaModalit.setEnabled(false); txtpnSelezionaLaModalit.setEditable(false); txtpnSelezionaLaModalit.setFont(new Font("Tahoma", Font.PLAIN, 16)); txtpnSelezionaLaModalit.setText("Seleziona la modalit\u00E0"); txtpnSelezionaLaModalit.setParagraphAttributes(attribs, true); panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.X_AXIS)); panel_1.add(txtpnSelezionaLaModalit); JPanel panel_2 = new JPanel(); panelIniziale.add(panel_2, BorderLayout.NORTH); JLabel lblLogo = new JLabel(""); lblLogo.setIcon(imIcon); panel_2.add(lblLogo); panelCreaEvento = new JPanel(); frame.getContentPane().add(panelCreaEvento, "name_10426205657299"); JPanel panel_5 = new JPanel(); JPanel panel_3 = new JPanel(); panelCreaEvento.setLayout(new BorderLayout(0, 0)); panelCreaEvento.add(panel_5); GridBagLayout gbl_panel_5 = new GridBagLayout(); gbl_panel_5.columnWidths = new int[] {64, 66, 67, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 81, 48, 43, 55, 0}; gbl_panel_5.rowHeights = new int[] {0, 0, 30, 20, 35, 20, 35, 20, 0, 0}; gbl_panel_5.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_panel_5.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; panel_5.setLayout(gbl_panel_5); Component verticalStrut_1 = Box.createVerticalStrut(20); GridBagConstraints gbc_verticalStrut_1 = new GridBagConstraints(); gbc_verticalStrut_1.insets = new Insets(0, 0, 5, 5); gbc_verticalStrut_1.gridx = 13; gbc_verticalStrut_1.gridy = 0; panel_5.add(verticalStrut_1, gbc_verticalStrut_1); Component verticalStrut_2 = Box.createVerticalStrut(20); GridBagConstraints gbc_verticalStrut_2 = new GridBagConstraints(); gbc_verticalStrut_2.insets = new Insets(0, 0, 5, 5); gbc_verticalStrut_2.gridx = 13; gbc_verticalStrut_2.gridy = 1; panel_5.add(verticalStrut_2, gbc_verticalStrut_2); JLabel lblInserisciDatiEvento = new JLabel("Inserisci dati evento"); lblInserisciDatiEvento.setFont(new Font("Tahoma", Font.PLAIN, 18)); GridBagConstraints gbc_lblInserisciDatiEvento = new GridBagConstraints(); gbc_lblInserisciDatiEvento.gridwidth = 2; gbc_lblInserisciDatiEvento.insets = new Insets(0, 0, 5, 5); gbc_lblInserisciDatiEvento.gridx = 1; gbc_lblInserisciDatiEvento.gridy = 2; panel_5.add(lblInserisciDatiEvento, gbc_lblInserisciDatiEvento); JLabel lblNomeEvento = new JLabel("Nome evento"); lblNomeEvento.setFont(new Font("Tahoma", Font.PLAIN, 13)); GridBagConstraints gbc_lblNomeEvento = new GridBagConstraints(); gbc_lblNomeEvento.gridwidth = 2; gbc_lblNomeEvento.fill = GridBagConstraints.HORIZONTAL; gbc_lblNomeEvento.insets = new Insets(0, 0, 5, 5); gbc_lblNomeEvento.gridx = 1; gbc_lblNomeEvento.gridy = 3; panel_5.add(lblNomeEvento, gbc_lblNomeEvento); textFieldNome = new JTextField(); textFieldNome.setColumns(10); GridBagConstraints gbc_textFieldNome = new GridBagConstraints(); gbc_textFieldNome.anchor = GridBagConstraints.NORTH; gbc_textFieldNome.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldNome.insets = new Insets(0, 0, 5, 5); gbc_textFieldNome.gridwidth = 5; gbc_textFieldNome.gridx = 3; gbc_textFieldNome.gridy = 3; panel_5.add(textFieldNome, gbc_textFieldNome); JLabel lblLuogoEvento = new JLabel("Luogo evento"); lblLuogoEvento.setFont(new Font("Tahoma", Font.PLAIN, 13)); GridBagConstraints gbc_lblLuogoEvento = new GridBagConstraints(); gbc_lblLuogoEvento.gridwidth = 2; gbc_lblLuogoEvento.fill = GridBagConstraints.HORIZONTAL; gbc_lblLuogoEvento.insets = new Insets(0, 0, 5, 5); gbc_lblLuogoEvento.gridx = 1; gbc_lblLuogoEvento.gridy = 5; panel_5.add(lblLuogoEvento, gbc_lblLuogoEvento); textFieldLuogo = new JTextField(); textFieldLuogo.setColumns(10); GridBagConstraints gbc_textFieldLuogo = new GridBagConstraints(); gbc_textFieldLuogo.anchor = GridBagConstraints.NORTH; gbc_textFieldLuogo.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldLuogo.insets = new Insets(0, 0, 5, 5); gbc_textFieldLuogo.gridwidth = 5; gbc_textFieldLuogo.gridx = 3; gbc_textFieldLuogo.gridy = 5; panel_5.add(textFieldLuogo, gbc_textFieldLuogo); JLabel lblProvincia = new JLabel("Provincia"); GridBagConstraints gbc_lblProvincia = new GridBagConstraints(); gbc_lblProvincia.anchor = GridBagConstraints.WEST; gbc_lblProvincia.insets = new Insets(0, 0, 5, 5); gbc_lblProvincia.gridx = 9; gbc_lblProvincia.gridy = 5; panel_5.add(lblProvincia, gbc_lblProvincia); JComboBox comboBoxProvincia = new JComboBox(provinceArray); GridBagConstraints gbc_comboBoxProvincia = new GridBagConstraints(); gbc_comboBoxProvincia.anchor = GridBagConstraints.NORTHWEST; gbc_comboBoxProvincia.insets = new Insets(0, 0, 5, 5); gbc_comboBoxProvincia.gridx = 10; gbc_comboBoxProvincia.gridy = 5; panel_5.add(comboBoxProvincia, gbc_comboBoxProvincia); JLabel lblDataEvento = new JLabel("Data evento"); lblDataEvento.setFont(new Font("Tahoma", Font.PLAIN, 13)); GridBagConstraints gbc_lblDataEvento = new GridBagConstraints(); gbc_lblDataEvento.gridwidth = 2; gbc_lblDataEvento.fill = GridBagConstraints.HORIZONTAL; gbc_lblDataEvento.insets = new Insets(0, 0, 0, 5); gbc_lblDataEvento.gridx = 1; gbc_lblDataEvento.gridy = 7; panel_5.add(lblDataEvento, gbc_lblDataEvento); JComboBox comboBoxGiorno = new JComboBox(giorniArray); GridBagConstraints gbc_comboBoxGiorno = new GridBagConstraints(); gbc_comboBoxGiorno.anchor = GridBagConstraints.NORTHWEST; gbc_comboBoxGiorno.insets = new Insets(0, 0, 0, 5); gbc_comboBoxGiorno.gridx = 3; gbc_comboBoxGiorno.gridy = 7; panel_5.add(comboBoxGiorno, gbc_comboBoxGiorno); JComboBox comboBoxMese = new JComboBox(mesiArray); GridBagConstraints gbc_comboBoxMese = new GridBagConstraints(); gbc_comboBoxMese.anchor = GridBagConstraints.NORTHWEST; gbc_comboBoxMese.insets = new Insets(0, 0, 0, 5); gbc_comboBoxMese.gridx = 4; gbc_comboBoxMese.gridy = 7; panel_5.add(comboBoxMese, gbc_comboBoxMese); JComboBox comboBoxAnno = new JComboBox(anniArray); GridBagConstraints gbc_comboBoxAnno = new GridBagConstraints(); gbc_comboBoxAnno.insets = new Insets(0, 0, 0, 5); gbc_comboBoxAnno.anchor = GridBagConstraints.NORTHEAST; gbc_comboBoxAnno.gridx = 5; gbc_comboBoxAnno.gridy = 7; panel_5.add(comboBoxAnno, gbc_comboBoxAnno); JLabel lblOra = new JLabel("Ora"); GridBagConstraints gbc_lblOra = new GridBagConstraints(); gbc_lblOra.anchor = GridBagConstraints.EAST; gbc_lblOra.insets = new Insets(0, 0, 0, 5); gbc_lblOra.gridx = 8; gbc_lblOra.gridy = 7; panel_5.add(lblOra, gbc_lblOra); JComboBox comboBoxOre = new JComboBox(oreArray); GridBagConstraints gbc_comboBox_1 = new GridBagConstraints(); gbc_comboBox_1.insets = new Insets(0, 0, 0, 5); gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_1.gridx = 10; gbc_comboBox_1.gridy = 7; panel_5.add(comboBoxOre, gbc_comboBox_1); JComboBox comboBoxMinuti = new JComboBox(minutiArray); GridBagConstraints gbc_comboBox_2 = new GridBagConstraints(); gbc_comboBox_2.insets = new Insets(0, 0, 0, 5); gbc_comboBox_2.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_2.gridx = 12; gbc_comboBox_2.gridy = 7; panel_5.add(comboBoxMinuti, gbc_comboBox_2); panelCreaEvento.add(panel_3, BorderLayout.NORTH); GridBagLayout gbl_panel_3 = new GridBagLayout(); gbl_panel_3.columnWidths = new int[] {0, 0, 0, 200, 0, 227, 77, 0, 0, 0}; gbl_panel_3.rowHeights = new int[] {0, 0, 23, 0}; gbl_panel_3.columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_panel_3.rowWeights = new double[] {0.0, 0.0, 0.0, Double.MIN_VALUE}; panel_3.setLayout(gbl_panel_3); Component verticalStrut = Box.createVerticalStrut(20); GridBagConstraints gbc_verticalStrut = new GridBagConstraints(); gbc_verticalStrut.insets = new Insets(0, 0, 5, 5); gbc_verticalStrut.gridx = 6; gbc_verticalStrut.gridy = 0; panel_3.add(verticalStrut, gbc_verticalStrut); JLabel lblInserisciPercorsoFile = new JLabel("Inserisci percorso file nominativi"); GridBagConstraints gbc_lblInserisciPercorsoFile = new GridBagConstraints(); gbc_lblInserisciPercorsoFile.insets = new Insets(0, 0, 5, 5); gbc_lblInserisciPercorsoFile.gridx = 3; gbc_lblInserisciPercorsoFile.gridy = 1; panel_3.add(lblInserisciPercorsoFile, gbc_lblInserisciPercorsoFile); textField = new JTextField(); textField.setPreferredSize(new Dimension(6, 25)); textField.setColumns(10); GridBagConstraints gbc_textField = new GridBagConstraints(); gbc_textField.fill = GridBagConstraints.HORIZONTAL; gbc_textField.insets = new Insets(0, 0, 5, 5); gbc_textField.gridx = 5; gbc_textField.gridy = 1; panel_3.add(textField, gbc_textField); JButton btnNewButton_2 = new JButton("Apri..."); btnNewButton_2.setPreferredSize(new Dimension(135, 25)); btnNewButton_2.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("Choose the folder"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile()); file = chooser.getSelectedFile(); inputFilePath = file.getAbsolutePath(); textField.setText(inputFilePath); } } }); GridBagConstraints gbc_btnNewButton_2 = new GridBagConstraints(); gbc_btnNewButton_2.insets = new Insets(0, 0, 5, 5); gbc_btnNewButton_2.fill = GridBagConstraints.HORIZONTAL; gbc_btnNewButton_2.gridx = 6; gbc_btnNewButton_2.gridy = 1; panel_3.add(btnNewButton_2, gbc_btnNewButton_2); Component horizontalStrut = Box.createHorizontalStrut(20); GridBagConstraints gbc_horizontalStrut = new GridBagConstraints(); gbc_horizontalStrut.insets = new Insets(0, 0, 0, 5); gbc_horizontalStrut.gridx = 2; gbc_horizontalStrut.gridy = 2; panel_3.add(horizontalStrut, gbc_horizontalStrut); Component horizontalStrut_1 = Box.createHorizontalStrut(20); GridBagConstraints gbc_horizontalStrut_1 = new GridBagConstraints(); gbc_horizontalStrut_1.insets = new Insets(0, 0, 0, 5); gbc_horizontalStrut_1.gridx = 7; gbc_horizontalStrut_1.gridy = 2; panel_3.add(horizontalStrut_1, gbc_horizontalStrut_1); JPanel panel_4 = new JPanel(); panelCreaEvento.add(panel_4, BorderLayout.SOUTH); JButton btnNewButton_3 = new JButton("Crea evento"); btnNewButton_3.setPreferredSize(new Dimension(95, 25)); btnNewButton_3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { int giorno = Integer.parseInt((String) comboBoxGiorno.getSelectedItem()); int mese = comboBoxMese.getSelectedIndex(); int anno = Integer.parseInt((String) comboBoxAnno.getSelectedItem()); int ore = Integer.parseInt((String) comboBoxOre.getSelectedItem()); int minuti = Integer.parseInt((String) comboBoxMinuti.getSelectedItem()); inputFilePath = textField.getText(); file = new File(inputFilePath); if (!isValidDate(giorno, mese, anno)) { JOptionPane.showMessageDialog( frame, "Data non corretta.", "Errore", JOptionPane.ERROR_MESSAGE); } else if (!extensionIs("xlsx", file)) { JOptionPane.showMessageDialog( frame, "Formato file non corretto.", "Errore", JOptionPane.ERROR_MESSAGE); } else { inputFilePath = textField.getText(); /*try { l = Loader.generateList(inputFilePath); } catch (Exception e) { JOptionPane.showMessageDialog(frame, "Errore nel file di input.", "Errore", JOptionPane.ERROR_MESSAGE); }*/ evento = new Event( textFieldNome.getText(), textFieldLuogo.getText(), (String) comboBoxProvincia.getSelectedItem(), new GregorianCalendar(anno, mese, giorno, ore, minuti), l); frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { evento.generateList(inputFilePath); } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog( frame, "Errore nel file di output.", "Errore", JOptionPane.ERROR_MESSAGE); } evento.toString(); File dir = new File(inputFilePath); evento.assignQR(dir.getParent()); frame.setCursor(null); frame.setBounds(100, 100, 750, 400); panelCreaEvento.setVisible(false); panelInviaMail.setVisible(true); } } }); panel_4.add(btnNewButton_3); JButton btnNewButton_4 = new JButton("Indietro"); btnNewButton_4.setPreferredSize(new Dimension(95, 25)); btnNewButton_4.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { panelCreaEvento.setVisible(false); panelIniziale.setVisible(true); } }); panel_4.add(btnNewButton_4); panelCaricaPartecipanti = new JPanel(); frame.getContentPane().add(panelCaricaPartecipanti, "name_80084471932092"); panelCaricaPartecipanti.setLayout(new BorderLayout(0, 0)); JPanel panel_9 = new JPanel(); panelCaricaPartecipanti.add(panel_9); GridBagLayout gbl_panel_9 = new GridBagLayout(); gbl_panel_9.columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0}; gbl_panel_9.rowHeights = new int[] {0, 0, 0, 0, 0, 0}; gbl_panel_9.columnWeights = new double[] {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_panel_9.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; panel_9.setLayout(gbl_panel_9); JLabel lblInserisciFileExcel = new JLabel("Inserisci file Excel di output"); GridBagConstraints gbc_lblInserisciFileExcel = new GridBagConstraints(); gbc_lblInserisciFileExcel.insets = new Insets(0, 0, 5, 5); gbc_lblInserisciFileExcel.gridx = 2; gbc_lblInserisciFileExcel.gridy = 2; panel_9.add(lblInserisciFileExcel, gbc_lblInserisciFileExcel); textField_1 = new JTextField(); GridBagConstraints gbc_textField_1 = new GridBagConstraints(); gbc_textField_1.insets = new Insets(0, 0, 5, 5); gbc_textField_1.fill = GridBagConstraints.HORIZONTAL; gbc_textField_1.gridx = 3; gbc_textField_1.gridy = 2; panel_9.add(textField_1, gbc_textField_1); textField_1.setColumns(10); JButton btnNewButton_7 = new JButton("Scegli file..."); btnNewButton_7.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("Choose the folder"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile()); file = chooser.getSelectedFile(); excelOutputFilePath = file.getAbsolutePath(); textField_1.setText(excelOutputFilePath); } } }); GridBagConstraints gbc_btnNewButton_7 = new GridBagConstraints(); gbc_btnNewButton_7.insets = new Insets(0, 0, 5, 5); gbc_btnNewButton_7.gridx = 5; gbc_btnNewButton_7.gridy = 2; panel_9.add(btnNewButton_7, gbc_btnNewButton_7); JLabel lblInserisciFileDelle = new JLabel("Inserisci file delle scansioni"); GridBagConstraints gbc_lblInserisciFileDelle = new GridBagConstraints(); gbc_lblInserisciFileDelle.insets = new Insets(0, 0, 0, 5); gbc_lblInserisciFileDelle.gridx = 2; gbc_lblInserisciFileDelle.gridy = 4; panel_9.add(lblInserisciFileDelle, gbc_lblInserisciFileDelle); textField_2 = new JTextField(); GridBagConstraints gbc_textField_2 = new GridBagConstraints(); gbc_textField_2.insets = new Insets(0, 0, 0, 5); gbc_textField_2.fill = GridBagConstraints.HORIZONTAL; gbc_textField_2.gridx = 3; gbc_textField_2.gridy = 4; panel_9.add(textField_2, gbc_textField_2); textField_2.setColumns(10); JButton btnNewButton_8 = new JButton("Scegli file..."); btnNewButton_8.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle("Choose the folder"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile()); file = chooser.getSelectedFile(); txtOutputFilePath = file.getAbsolutePath(); textField_2.setText(txtOutputFilePath); } } }); GridBagConstraints gbc_btnNewButton_8 = new GridBagConstraints(); gbc_btnNewButton_8.insets = new Insets(0, 0, 0, 5); gbc_btnNewButton_8.gridx = 5; gbc_btnNewButton_8.gridy = 4; panel_9.add(btnNewButton_8, gbc_btnNewButton_8); JPanel panel_10 = new JPanel(); panelCaricaPartecipanti.add(panel_10, BorderLayout.NORTH); JPanel panel_11 = new JPanel(); panelCaricaPartecipanti.add(panel_11, BorderLayout.SOUTH); JButton btnNewButton_9 = new JButton("Associa"); btnNewButton_9.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { txtOutputFilePath = textField_2.getText(); File f = new File(txtOutputFilePath); excelOutputFilePath = textField_1.getText(); Loader.writeInOut(excelOutputFilePath, Loader.loadParticipants(f)); JOptionPane.showMessageDialog( frame, "Associazione degli orari eseguita!", "", JOptionPane.PLAIN_MESSAGE); } }); panel_11.add(btnNewButton_9); JButton btnNewButton_10 = new JButton("Annulla"); panel_11.add(btnNewButton_10); }
public ParametricFunctionLabel(Function function) { super(function); // GUI representation GridBagLayout gbl_fLabel = new GridBagLayout(); gbl_fLabel.columnWidths = new int[] {0, 0, 150, 30, 0, 0}; gbl_fLabel.rowHeights = new int[] {5, 0, 0, 0, 0, 0, 0}; gbl_fLabel.columnWeights = new double[] {0.0, 0.0, 1.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_fLabel.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; this.setLayout(gbl_fLabel); lblX = new JLabel("x ="); GridBagConstraints gbc_lblX = new GridBagConstraints(); gbc_lblX.insets = new Insets(0, 0, 5, 5); gbc_lblX.anchor = GridBagConstraints.EAST; gbc_lblX.gridx = 1; gbc_lblX.gridy = 1; add(lblX, gbc_lblX); exprFieldX = new JTextField(function.getExpression()[0]); GridBagConstraints gbc_list = new GridBagConstraints(); gbc_list.insets = new Insets(0, 0, 5, 5); gbc_list.fill = GridBagConstraints.HORIZONTAL; gbc_list.gridx = 2; gbc_list.gridy = 1; this.add(exprFieldX, gbc_list); toggleButton = new ToggleButton( new ImageIcon("Icons/selected.png"), new ImageIcon("Icons/notSelected.png")); GridBagConstraints gbc_chckbxTest = new GridBagConstraints(); gbc_chckbxTest.gridheight = 2; gbc_chckbxTest.insets = new Insets(0, 0, 5, 5); gbc_chckbxTest.gridx = 3; gbc_chckbxTest.gridy = 1; this.add(toggleButton, gbc_chckbxTest); lblY = new JLabel("y ="); GridBagConstraints gbc_lblY = new GridBagConstraints(); gbc_lblY.gridheight = 2; gbc_lblY.insets = new Insets(0, 0, 5, 5); gbc_lblY.anchor = GridBagConstraints.EAST; gbc_lblY.gridx = 1; gbc_lblY.gridy = 2; add(lblY, gbc_lblY); exprFieldY = new JTextField(function.getExpression()[1]); GridBagConstraints gbc_textField = new GridBagConstraints(); gbc_textField.gridheight = 2; gbc_textField.insets = new Insets(0, 0, 5, 5); gbc_textField.fill = GridBagConstraints.HORIZONTAL; gbc_textField.gridx = 2; gbc_textField.gridy = 2; add(exprFieldY, gbc_textField); exprFieldY.setColumns(10); lblZ = new JLabel("z ="); GridBagConstraints gbc_lblZ = new GridBagConstraints(); gbc_lblZ.insets = new Insets(0, 0, 5, 5); gbc_lblZ.anchor = GridBagConstraints.EAST; gbc_lblZ.gridx = 1; gbc_lblZ.gridy = 4; add(lblZ, gbc_lblZ); exprFieldZ = new JTextField(function.getExpression()[2]); GridBagConstraints gbc_textField_1 = new GridBagConstraints(); gbc_textField_1.insets = new Insets(0, 0, 5, 5); gbc_textField_1.fill = GridBagConstraints.HORIZONTAL; gbc_textField_1.gridx = 2; gbc_textField_1.gridy = 4; add(exprFieldZ, gbc_textField_1); exprFieldZ.setColumns(10); // Don't f**k up layout, when text string becomes too long. exprFieldX.setPreferredSize(new Dimension(100, 20)); exprFieldY.setPreferredSize(new Dimension(100, 20)); exprFieldZ.setPreferredSize(new Dimension(100, 20)); btnDelete = new JButton(new ImageIcon("Icons/delete.png")); GridBagConstraints gbc_btnDelete = new GridBagConstraints(); gbc_btnDelete.gridheight = 2; gbc_btnDelete.insets = new Insets(0, 0, 5, 5); gbc_btnDelete.gridx = 3; gbc_btnDelete.gridy = 3; add(btnDelete, gbc_btnDelete); // Add listeners; addTextChangeListener(); addToggleButtonListener(); addDeleteListener(); this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); GuiUtil.setupUndoListener(exprFieldX); GuiUtil.setupUndoListener(exprFieldY); GuiUtil.setupUndoListener(exprFieldZ); }