List of usage examples for javax.swing SwingConstants RIGHT
int RIGHT
To view the source code for javax.swing SwingConstants RIGHT.
Click Source Link
From source file:LDAPTest.java
/** * Constructs the data panel.// w w w. j ava2 s.c o m * @param attributes the attributes of the given entry */ public DataPanel(Attributes attrs) throws NamingException { setLayout(new java.awt.GridLayout(0, 2, 3, 1)); NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll(); while (attrEnum.hasMore()) { Attribute attr = attrEnum.next(); String id = attr.getID(); NamingEnumeration<?> valueEnum = attr.getAll(); while (valueEnum.hasMore()) { Object value = valueEnum.next(); if (id.equals("userPassword")) value = new String((byte[]) value); JLabel idLabel = new JLabel(id, SwingConstants.RIGHT); JTextField valueField = new JTextField("" + value); if (id.equals("objectClass")) valueField.setEditable(false); if (!id.equals("uid")) { add(idLabel); add(valueField); } } } }
From source file:edu.ku.brc.specify.utilapps.SetUpBuildDlg.java
public void createUI() { super.createUI(); Specify.setUpSystemProperties();/*w ww . jav a 2 s. c o m*/ UIFieldFormatterMgr.setDoingLocal(true); driverList = DatabaseDriverInfo.getDriversList(); int inx = Collections.binarySearch(driverList, new DatabaseDriverInfo(dbDriverName, null, null, false, null)); drivers = createComboBox(driverList); drivers.setSelectedIndex(inx); catNumFmtList = (Vector<UIFieldFormatterIFace>) UIFieldFormatterMgr.getInstance() .getFormatterList(CollectionObject.class, "catalogNumber"); Collections.sort(catNumFmtList, new Comparator<UIFieldFormatterIFace>() { @Override public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); for (UIFieldFormatterIFace fmt : catNumFmtList) { catNumFmtHash.put(fmt.getName(), fmt); } accNumFmtList = (Vector<UIFieldFormatterIFace>) UIFieldFormatterMgr.getInstance() .getFormatterList(Accession.class, "accessionNumber"); Collections.sort(accNumFmtList, new Comparator<UIFieldFormatterIFace>() { @Override public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) { return o1.getTitle().compareTo(o2.getTitle()); } }); for (UIFieldFormatterIFace fmt : accNumFmtList) { accNumFmtHash.put(fmt.getName(), fmt); } catNumGrpList = new Vector<String>(); catNumGrpList.add("None"); catNumGrpList.add("Cat Global"); catNumGrpList.add("Cat Test Group #1"); catNumGrpList.add("Cat Test Group #2"); for (DisciplineType d : DisciplineType.getDisciplineList()) { catNumGrpList.add("Cat " + d.getTitle() + " Group"); } accNumGrpList = new Vector<String>(); accNumGrpList.add("None"); accNumGrpList.add("Acc Global"); accNumGrpList.add("Acc Test Group #1"); accNumGrpList.add("Acc Test Group #2"); for (DisciplineType d : DisciplineType.getDisciplineList()) { accNumGrpList.add("Acc " + d.getTitle() + " Group"); } databaseNameTxt = addAutoSelect(createTextField(databaseName, 15)); dbUsernameTxtFld = addAutoSelect(createTextField(dbUser.first, 15)); dbPasswdTxtFld = addAutoSelect(createPasswordField(dbUser.second, 15)); saUsernameTxtFld = addAutoSelect(createTextField(saUser.first, 15)); saPasswdTxtFld = addAutoSelect(createPasswordField(saUser.second, 15)); usrUsernameTxtFld = addAutoSelect(createTextField(cmUser.first, 15)); usrPasswdTxtFld = addAutoSelect(createPasswordField(cmUser.second, 15)); extraCollectionsChk = createCheckBox("Create Extra Collections"); extraCollectionsChk.setSelected(true); PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p,10px,p,2px,p,10px,p,2px,p,p:g", UIHelper.createDuplicateJGoodiesDef("P", "2px", 9) + ",f:p:g,4px,p")); CellConstraints cc = new CellConstraints(); int y = 1; builder.addSeparator("Username and Passwords", cc.xyw(1, y, 12)); y += 2; builder.add(createLabel("IT Username:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(dbUsernameTxtFld, cc.xy(3, y)); builder.add(createLabel("Master Username:", SwingConstants.RIGHT), cc.xy(5, y)); builder.add(saUsernameTxtFld, cc.xy(7, y)); builder.add(createLabel("User Username:", SwingConstants.RIGHT), cc.xy(9, y)); builder.add(usrUsernameTxtFld, cc.xy(11, y)); y += 2; builder.add(createLabel("IT Password:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(dbPasswdTxtFld, cc.xy(3, y)); builder.add(createLabel("Master Password:", SwingConstants.RIGHT), cc.xy(5, y)); builder.add(saPasswdTxtFld, cc.xy(7, y)); builder.add(createLabel("User Password:", SwingConstants.RIGHT), cc.xy(9, y)); builder.add(usrPasswdTxtFld, cc.xy(11, y)); y += 2; builder.addSeparator("Database Info", cc.xyw(1, y, 12)); y += 2; builder.add(createLabel("Database Name:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(databaseNameTxt, cc.xy(3, y)); y += 2; builder.add(createLabel("Driver:", SwingConstants.RIGHT), cc.xy(1, y)); builder.add(drivers, cc.xy(3, y)); y += 2; builder.addSeparator("Collection Options", cc.xyw(1, y, 12)); y += 2; collChoiceList = loadPersistedChoices(); fillChoicesWithDefaults(); choiceTable = new JTable(new DisciplineSetupModel()); choiceTable.setRowHeight((new JComboBox()).getPreferredSize().height); TableColumn col = choiceTable.getColumnModel().getColumn(2); col.setCellEditor(new MyComboBoxEditor(catNumFmtList, catNumFmtHash)); col.setCellRenderer(new MyLabelRenderer(catNumFmtHash)); col = choiceTable.getColumnModel().getColumn(3); col.setCellEditor(new MyComboBoxStringEditor(catNumGrpList)); col = choiceTable.getColumnModel().getColumn(4); col.setCellEditor(new MyComboBoxEditor(accNumFmtList, accNumFmtHash)); col = choiceTable.getColumnModel().getColumn(5); col.setCellEditor(new MyComboBoxStringEditor(accNumGrpList)); //col.setCellRenderer(new MyComboBoxRenderer(catNumFmtList)); UIHelper.makeTableHeadersCentered(choiceTable, false); calcColumnWidths(choiceTable); builder.add(UIHelper.createScrollPane(choiceTable), cc.xywh(1, y, 12, 1)); y += 2; final JButton catGblBtn = createButton("Global Cat Nums"); final JButton accGblBtn = createButton("Global Acc Nums"); final JButton selectAllBtn = createButton("Select All"); final JButton deSelectAll = createButton("Deselect All"); final JButton defBtn = createButton("Revert"); PanelBuilder btnBar = new PanelBuilder( new FormLayout("f:p:g," + UIHelper.createDuplicateJGoodiesDef("p", "4px", 5), "p")); btnBar.add(catGblBtn, cc.xy(2, 1)); btnBar.add(accGblBtn, cc.xy(4, 1)); btnBar.add(selectAllBtn, cc.xy(6, 1)); btnBar.add(deSelectAll, cc.xy(8, 1)); btnBar.add(defBtn, cc.xy(10, 1)); builder.add(btnBar.getPanel(), cc.xywh(1, y, 12, 1)); y += 2; catGblBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setCatNumGroup("Cat Group"); } }); accGblBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { setAccNumGroup("Acc Group"); } }); selectAllBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { selectAll(true); } }); deSelectAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { selectAll(false); } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { closeDlg(true); } }); okBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { saveChoices(collChoiceList); closeDlg(false); } }); defBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { resetDefaults(collChoiceList); } }); // make sure closing the window does the same thing as clicking cancel this.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { cancelBtn.doClick(); } }); builder.setDefaultDialogBorder(); contentPanel = builder.getPanel(); mainPanel.add(contentPanel, BorderLayout.CENTER); pack(); Dimension size = getSize(); size.width = Math.max(size.width, 900); setSize(size); }
From source file:com.floreantpos.ui.views.payment.SettleTicketDialog.java
private JPanel createTotalViewerPanel() { JLabel lblSubtotal = new javax.swing.JLabel(); lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblSubtotal.setText(com.floreantpos.POSConstants.SUBTOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfSubtotal = new javax.swing.JTextField(10); tfSubtotal.setHorizontalAlignment(SwingConstants.TRAILING); tfSubtotal.setEditable(false);/*from www . ja v a2 s. c o m*/ JLabel lblDiscount = new javax.swing.JLabel(); lblDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDiscount.setText(Messages.getString("TicketView.9") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDiscount = new javax.swing.JTextField(10); // tfDiscount.setFont(tfDiscount.getFont().deriveFont(Font.PLAIN, 16)); tfDiscount.setHorizontalAlignment(SwingConstants.TRAILING); tfDiscount.setEditable(false); tfDiscount.setText(ticket.getDiscountAmount().toString()); JLabel lblDeliveryCharge = new javax.swing.JLabel(); lblDeliveryCharge.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDeliveryCharge.setText("Delivery Charge:" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDeliveryCharge = new javax.swing.JTextField(10); tfDeliveryCharge.setHorizontalAlignment(SwingConstants.TRAILING); tfDeliveryCharge.setEditable(false); JLabel lblTax = new javax.swing.JLabel(); lblTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTax.setText(com.floreantpos.POSConstants.TAX + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTax = new javax.swing.JTextField(10); // tfTax.setFont(tfTax.getFont().deriveFont(Font.PLAIN, 16)); tfTax.setEditable(false); tfTax.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblGratuity = new javax.swing.JLabel(); lblGratuity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblGratuity .setText(Messages.getString("SettleTicketDialog.5") + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ tfGratuity = new javax.swing.JTextField(10); tfGratuity.setEditable(false); tfGratuity.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblTotal = new javax.swing.JLabel(); lblTotal.setFont(lblTotal.getFont().deriveFont(Font.BOLD, PosUIManager.getFontSize(18))); lblTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTotal.setText(com.floreantpos.POSConstants.TOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTotal = new javax.swing.JTextField(10); tfTotal.setFont(tfTotal.getFont().deriveFont(Font.BOLD, PosUIManager.getFontSize(18))); tfTotal.setHorizontalAlignment(SwingConstants.TRAILING); tfTotal.setEditable(false); JPanel ticketAmountPanel = new com.floreantpos.swing.TransparentPanel( new MigLayout("hidemode 3,ins 2 2 3 2,alignx trailing,fill", "[grow]2[]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ticketAmountPanel.add(lblSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblDiscount, "newline,growx,aligny center"); //$NON-NLS-1$ //$NON-NLS-2$ ticketAmountPanel.add(tfDiscount, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTax, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTax, "growx,aligny center"); //$NON-NLS-1$ if (ticket.getOrderType().isDelivery() && !ticket.isCustomerWillPickup()) { ticketAmountPanel.add(lblDeliveryCharge, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfDeliveryCharge, "growx,aligny center"); //$NON-NLS-1$ } ticketAmountPanel.add(lblGratuity, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfGratuity, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTotal, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTotal, "growx,aligny center"); //$NON-NLS-1$ return ticketAmountPanel; }
From source file:com.digitalgeneralists.assurance.ui.components.SettingsPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { this.dialogTitle = Application.applicationShortName + " Settings"; // NOTE: There is no notion of add-mode in this dialog. There should // always be a single instance of the application configuration. if (this.configuration == null) { this.configuration = ApplicationConfiguration.createDefaultConfiguration(); }//from w ww .j av a 2s . co m this.mode = AssuranceDialogMode.EDIT; GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel scanSettingsPanel = new JPanel(); scanSettingsPanel.setLayout(new GridBagLayout()); Border scanSettingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); scanSettingsPanelBorder = BorderFactory.createTitledBorder(scanSettingsPanelBorder, "Scan Settings", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints scanSettingsPanelConstraints = new GridBagConstraints(); scanSettingsPanelConstraints.anchor = GridBagConstraints.NORTH; scanSettingsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; scanSettingsPanelConstraints.gridx = 0; scanSettingsPanelConstraints.gridy = 0; scanSettingsPanelConstraints.weightx = 1.0; scanSettingsPanelConstraints.weighty = 1.0; scanSettingsPanelConstraints.gridheight = 1; scanSettingsPanelConstraints.gridwidth = 2; scanSettingsPanelConstraints.insets = new Insets(5, 5, 5, 5); scanSettingsPanel.setBorder(scanSettingsPanelBorder); this.add(scanSettingsPanel, scanSettingsPanelConstraints); GridBagConstraints ignoredFileNamesLabelConstraints = new GridBagConstraints(); ignoredFileNamesLabelConstraints.anchor = GridBagConstraints.NORTHWEST; ignoredFileNamesLabelConstraints.fill = GridBagConstraints.NONE; ignoredFileNamesLabelConstraints.gridx = 0; ignoredFileNamesLabelConstraints.gridy = 0; ignoredFileNamesLabelConstraints.weightx = 1.0; ignoredFileNamesLabelConstraints.weighty = 1.0; ignoredFileNamesLabelConstraints.gridheight = 1; ignoredFileNamesLabelConstraints.gridwidth = 1; ignoredFileNamesLabelConstraints.insets = new Insets(5, 10, 0, 5); final JLabel ignoredFileNamesLabel = new JLabel("Ignored Files", SwingConstants.LEFT); scanSettingsPanel.add(ignoredFileNamesLabel, ignoredFileNamesLabelConstraints); GridBagConstraints ignoredFileNamesTextFieldConstraints = new GridBagConstraints(); ignoredFileNamesTextFieldConstraints.anchor = GridBagConstraints.NORTH; ignoredFileNamesTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; ignoredFileNamesTextFieldConstraints.gridx = 0; ignoredFileNamesTextFieldConstraints.gridy = 1; ignoredFileNamesTextFieldConstraints.weightx = 1.0; ignoredFileNamesTextFieldConstraints.weighty = 1.0; ignoredFileNamesTextFieldConstraints.gridheight = 1; ignoredFileNamesTextFieldConstraints.gridwidth = 2; ignoredFileNamesTextFieldConstraints.insets = new Insets(2, 5, 5, 5); GridBagConstraints ignoredFileExtensionsLabelConstraints = new GridBagConstraints(); ignoredFileExtensionsLabelConstraints.anchor = GridBagConstraints.NORTHWEST; ignoredFileExtensionsLabelConstraints.fill = GridBagConstraints.NONE; ignoredFileExtensionsLabelConstraints.gridx = 0; ignoredFileExtensionsLabelConstraints.gridy = 2; ignoredFileExtensionsLabelConstraints.weightx = 1.0; ignoredFileExtensionsLabelConstraints.weighty = 1.0; ignoredFileExtensionsLabelConstraints.gridheight = 1; ignoredFileExtensionsLabelConstraints.gridwidth = 1; ignoredFileExtensionsLabelConstraints.insets = new Insets(5, 10, 0, 5); final JLabel ignoredFileExtensionsLabel = new JLabel("Ignored File Extensions", SwingConstants.LEFT); scanSettingsPanel.add(ignoredFileExtensionsLabel, ignoredFileExtensionsLabelConstraints); GridBagConstraints ignoredFileExtensionsTextFieldConstraints = new GridBagConstraints(); ignoredFileExtensionsTextFieldConstraints.anchor = GridBagConstraints.NORTH; ignoredFileExtensionsTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; ignoredFileExtensionsTextFieldConstraints.gridx = 0; ignoredFileExtensionsTextFieldConstraints.gridy = 3; ignoredFileExtensionsTextFieldConstraints.weightx = 1.0; ignoredFileExtensionsTextFieldConstraints.weighty = 1.0; ignoredFileExtensionsTextFieldConstraints.gridheight = 1; ignoredFileExtensionsTextFieldConstraints.gridwidth = 2; ignoredFileExtensionsTextFieldConstraints.insets = new Insets(2, 5, 5, 5); scanSettingsPanel.add(this.ignoredFileNamesTextField, ignoredFileNamesTextFieldConstraints); this.ignoredFileNamesTextField.getDocument().addDocumentListener(this.textPropertyValidationListener); scanSettingsPanel.add(this.ignoredFileExtensionsTextField, ignoredFileExtensionsTextFieldConstraints); this.ignoredFileExtensionsTextField.getDocument() .addDocumentListener(this.textPropertyValidationListener); GridBagConstraints numberScanThreadsLabelConstraints = new GridBagConstraints(); numberScanThreadsLabelConstraints.anchor = GridBagConstraints.NORTH; numberScanThreadsLabelConstraints.fill = GridBagConstraints.NONE; numberScanThreadsLabelConstraints.gridx = 0; numberScanThreadsLabelConstraints.gridy = 4; numberScanThreadsLabelConstraints.weightx = 1.0; numberScanThreadsLabelConstraints.weighty = 1.0; numberScanThreadsLabelConstraints.gridheight = 1; numberScanThreadsLabelConstraints.gridwidth = 1; numberScanThreadsLabelConstraints.insets = new Insets(10, 5, 0, 5); final JLabel numberOfThreadsLabel = new JLabel("Number of Threads", SwingConstants.RIGHT); scanSettingsPanel.add(numberOfThreadsLabel, numberScanThreadsLabelConstraints); GridBagConstraints numberScanThreadsSpinnerConstraints = new GridBagConstraints(); numberScanThreadsSpinnerConstraints.anchor = GridBagConstraints.NORTHWEST; numberScanThreadsSpinnerConstraints.fill = GridBagConstraints.NONE; numberScanThreadsSpinnerConstraints.gridx = 1; numberScanThreadsSpinnerConstraints.gridy = 4; numberScanThreadsSpinnerConstraints.weightx = 1.0; numberScanThreadsSpinnerConstraints.weighty = 1.0; numberScanThreadsSpinnerConstraints.gridheight = 1; numberScanThreadsSpinnerConstraints.gridwidth = 1; numberScanThreadsSpinnerConstraints.insets = new Insets(5, 5, 5, 5); scanSettingsPanel.add(this.numberScanThreadsSpinner, numberScanThreadsSpinnerConstraints); if (this.configuration != null) { this.ignoredFileNamesTextField.setText(this.configuration.getIgnoredFileNames()); this.ignoredFileExtensionsTextField.setText(this.configuration.getIgnoredFileExtensions()); this.numberScanThreadsSpinner.setValue(this.configuration.getNumberOfScanThreads()); } this.initialized = true; } }
From source file:com.digitalgeneralists.assurance.ui.components.ScanDefinitionPanel.java
@Override protected void initializeComponent() { if (!this.initialized) { if (this.definition == null) { mode = AssuranceDialogMode.ADD; this.dialogTitle = "Add New Scan Definition"; this.definition = new ScanDefinition(); } else {/*from www .j a v a 2 s .co m*/ mode = AssuranceDialogMode.EDIT; this.dialogTitle = "Edit Scan Definition"; } GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); final JPanel optionsPanel = new JPanel(); optionsPanel.setLayout(new GridBagLayout()); Border optionsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); optionsBorder = BorderFactory.createTitledBorder(optionsBorder, "Merge Options", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints nameTextFieldConstraints = new GridBagConstraints(); nameTextFieldConstraints.anchor = GridBagConstraints.NORTH; nameTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL; nameTextFieldConstraints.gridx = 0; nameTextFieldConstraints.gridy = 0; nameTextFieldConstraints.weightx = 1.0; nameTextFieldConstraints.weighty = 1.0; nameTextFieldConstraints.gridheight = 1; nameTextFieldConstraints.gridwidth = 2; nameTextFieldConstraints.insets = new Insets(10, 5, 0, 5); this.nameTextField.setText(this.definition.getName()); this.nameTextField.getDocument().addDocumentListener(this.textPropertyValidationListener); this.add(this.nameTextField, nameTextFieldConstraints); Border existingScanMappingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); existingScanMappingsPanelBorder = BorderFactory.createTitledBorder(existingScanMappingsPanelBorder, "Paths", TitledBorder.CENTER, TitledBorder.TOP); GridBagConstraints existingScanMappingsPanelConstraints = new GridBagConstraints(); existingScanMappingsPanelConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsPanelConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsPanelConstraints.gridx = 0; existingScanMappingsPanelConstraints.gridy = 1; existingScanMappingsPanelConstraints.weightx = 1.0; existingScanMappingsPanelConstraints.weighty = 1.0; existingScanMappingsPanelConstraints.gridheight = 1; existingScanMappingsPanelConstraints.gridwidth = 2; existingScanMappingsPanelConstraints.insets = new Insets(5, 5, 0, 5); JPanel existingScanMappingsPanel = new JPanel(); GridBagLayout panelGridbag = new GridBagLayout(); existingScanMappingsPanel.setLayout(panelGridbag); existingScanMappingsPanel.setBorder(existingScanMappingsPanelBorder); this.add(existingScanMappingsPanel, existingScanMappingsPanelConstraints); GridBagConstraints existingScanMappingsListConstraints = new GridBagConstraints(); existingScanMappingsListConstraints.anchor = GridBagConstraints.WEST; existingScanMappingsListConstraints.fill = GridBagConstraints.BOTH; existingScanMappingsListConstraints.gridx = 0; existingScanMappingsListConstraints.gridy = 0; existingScanMappingsListConstraints.weightx = 1.0; existingScanMappingsListConstraints.weighty = 0.9; existingScanMappingsListConstraints.gridheight = 1; existingScanMappingsListConstraints.gridwidth = 2; existingScanMappingsListConstraints.insets = new Insets(5, 5, 5, 5); this.definition = (ScanDefinition) ModelUtils.initializeEntity(this.definition, ScanDefinition.SCAN_MAPPING_PROPERTY); this.scanMappingsList = new ListInputPanel<ScanMappingDefinition>(this.definition, this); existingScanMappingsPanel.add(this.scanMappingsList, existingScanMappingsListConstraints); GridBagConstraints optionsPanelConstraints = new GridBagConstraints(); optionsPanelConstraints.anchor = GridBagConstraints.SOUTH; optionsPanelConstraints.fill = GridBagConstraints.HORIZONTAL; optionsPanelConstraints.gridx = 0; optionsPanelConstraints.gridy = 3; optionsPanelConstraints.weightx = 1.0; optionsPanelConstraints.weighty = 1.0; optionsPanelConstraints.gridheight = 1; optionsPanelConstraints.gridwidth = 2; optionsPanelConstraints.insets = new Insets(5, 5, 5, 5); optionsPanel.setBorder(optionsBorder); this.add(optionsPanel, optionsPanelConstraints); GridBagConstraints strategyLabelConstraints = new GridBagConstraints(); strategyLabelConstraints.anchor = GridBagConstraints.WEST; strategyLabelConstraints.fill = GridBagConstraints.BOTH; strategyLabelConstraints.gridx = 0; strategyLabelConstraints.gridy = 0; strategyLabelConstraints.weightx = 1.0; strategyLabelConstraints.weighty = 1.0; strategyLabelConstraints.gridheight = 1; strategyLabelConstraints.gridwidth = 1; strategyLabelConstraints.insets = new Insets(5, 5, 0, 5); final JLabel strategyLabel = new JLabel("Strategy", SwingConstants.RIGHT); optionsPanel.add(strategyLabel, strategyLabelConstraints); GridBagConstraints strategyComboBoxConstraints = new GridBagConstraints(); strategyComboBoxConstraints.anchor = GridBagConstraints.WEST; strategyComboBoxConstraints.fill = GridBagConstraints.VERTICAL; strategyComboBoxConstraints.gridx = 1; strategyComboBoxConstraints.gridy = 0; strategyComboBoxConstraints.weightx = 1.0; strategyComboBoxConstraints.weighty = 1.0; strategyComboBoxConstraints.gridheight = 1; strategyComboBoxConstraints.gridwidth = 1; strategyComboBoxConstraints.insets = new Insets(5, 5, 0, 5); String[] strategyLabels = { "Source", "Target", "Both" }; this.strategyComboBox = new JComboBox<String>(strategyLabels); // NOTE: We should have better validation of the data state for these controls. // We could run into problems as the application versions over time. this.strategyComboBox.setSelectedIndex(this.definition.getMergeStrategy().ordinal()); this.strategyComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { validateFormState(); } }); optionsPanel.add(this.strategyComboBox, strategyComboBoxConstraints); GridBagConstraints autoMergeCheckBoxConstraints = new GridBagConstraints(); autoMergeCheckBoxConstraints.gridx = 0; autoMergeCheckBoxConstraints.gridy = 1; autoMergeCheckBoxConstraints.weightx = 1.0; autoMergeCheckBoxConstraints.weighty = 1.0; autoMergeCheckBoxConstraints.gridheight = 1; autoMergeCheckBoxConstraints.gridwidth = 2; autoMergeCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.autoMergeCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.autoMergeCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.autoMergeCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.autoMergeCheckBox, autoMergeCheckBoxConstraints); GridBagConstraints includeNonCreationTimestampsCheckBoxConstraints = new GridBagConstraints(); includeNonCreationTimestampsCheckBoxConstraints.gridx = 0; includeNonCreationTimestampsCheckBoxConstraints.gridy = 2; includeNonCreationTimestampsCheckBoxConstraints.weightx = 1.0; includeNonCreationTimestampsCheckBoxConstraints.weighty = 1.0; includeNonCreationTimestampsCheckBoxConstraints.gridheight = 1; includeNonCreationTimestampsCheckBoxConstraints.gridwidth = 2; includeNonCreationTimestampsCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeNonCreationTimestampCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeNonCreationTimestampCheckBox.setSelected(this.definition.getIncludeNonCreationTimestamps()); this.includeNonCreationTimestampCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeNonCreationTimestampCheckBox, includeNonCreationTimestampsCheckBoxConstraints); GridBagConstraints advancedAttributesCheckBoxConstraints = new GridBagConstraints(); advancedAttributesCheckBoxConstraints.gridx = 0; advancedAttributesCheckBoxConstraints.gridy = 3; advancedAttributesCheckBoxConstraints.weightx = 1.0; advancedAttributesCheckBoxConstraints.weighty = 1.0; advancedAttributesCheckBoxConstraints.gridheight = 1; advancedAttributesCheckBoxConstraints.gridwidth = 2; advancedAttributesCheckBoxConstraints.insets = new Insets(2, 5, 5, 5); this.includeAdvancedAttributesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT); this.includeAdvancedAttributesCheckBox.setSelected(this.definition.getAutoResolveConflicts()); this.includeAdvancedAttributesCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { validateFormState(); } }); optionsPanel.add(this.includeAdvancedAttributesCheckBox, advancedAttributesCheckBoxConstraints); this.scanMappingsList.loadData(); if (this.getMode() == AssuranceDialogMode.EDIT) { this.validateFormState(); } this.initialized = true; } }
From source file:net.sf.firemox.DeckBuilder.java
/** * Creates new form DeckBuilder/* w ww . j a v a 2 s . c o m*/ */ private DeckBuilder() { super("DeckBuilder"); form = this; timerPanel = new TimerGlassPane(); cardLoader = new CardLoader(timerPanel); timer = new Timer(200, cardLoader); setGlassPane(timerPanel); try { setIconImage(Picture.loadImage(IdConst.IMAGES_DIR + "deckbuilder.gif")); } catch (Exception e) { // IGNORING } // Load settings loadSettings(); // Initialize components final JMenuItem newItem = UIHelper.buildMenu("menu_db_new", 'n', this); newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK)); final JMenuItem loadItem = UIHelper.buildMenu("menu_db_load", 'o', this); loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); final JMenuItem saveAsItem = UIHelper.buildMenu("menu_db_saveas", 'a', this); saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0)); final JMenuItem saveItem = UIHelper.buildMenu("menu_db_save", 's', this); saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK)); final JMenuItem quitItem = UIHelper.buildMenu("menu_db_exit", this); quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK)); final JMenuItem deckConstraintsItem = UIHelper.buildMenu("menu_db_constraints", 'c', this); deckConstraintsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0)); final JMenuItem aboutItem = UIHelper.buildMenu("menu_help_about", 'a', this); aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.SHIFT_MASK)); final JMenuItem convertDCK = UIHelper.buildMenu("menu_convert_DCK_MP", this); final JMenu mainMenu = UIHelper.buildMenu("menu_file"); mainMenu.add(newItem); mainMenu.add(loadItem); mainMenu.add(saveAsItem); mainMenu.add(saveItem); mainMenu.add(new JSeparator()); mainMenu.add(quitItem); super.optionMenu = new JMenu("Options"); final JMenu convertMenu = UIHelper.buildMenu("menu_convert"); convertMenu.add(convertDCK); final JMenuItem helpItem = UIHelper.buildMenu("menu_help_help", 'h', this); helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); final JMenu helpMenu = new JMenu("?"); helpMenu.add(helpItem); helpMenu.add(deckConstraintsItem); helpMenu.add(aboutItem); final JMenuBar menuBar = new JMenuBar(); menuBar.add(mainMenu); initAbstractMenu(); menuBar.add(optionMenu); menuBar.add(convertMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); addWindowListener(this); // Build the panel containing amount of available cards final JLabel amountLeft = new JLabel("<html>0/?", SwingConstants.RIGHT); // Build the left list allListModel = new MListModel<MCardCompare>(amountLeft, false); leftList = new ThreadSafeJList(allListModel); leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); leftList.setLayoutOrientation(JList.VERTICAL); leftList.getSelectionModel().addListSelectionListener(this); leftList.addMouseListener(this); leftList.setVisibleRowCount(10); // Initialize the text field containing the amount to add addQtyTxt = new JTextField("1"); // Build the "Add" button addButton = new JButton(LanguageManager.getString("db_add")); addButton.setMnemonic('a'); addButton.setEnabled(false); // Build the panel containing : "Add" amount and "Add" button final Box addPanel = Box.createHorizontalBox(); addPanel.add(addButton); addPanel.add(addQtyTxt); addPanel.setMaximumSize(new Dimension(32010, 26)); // Build the panel containing the selected card name cardNameTxt = new JTextField(); new HireListener(cardNameTxt, addButton, this, leftList); final JLabel searchLabel = new JLabel(LanguageManager.getString("db_search") + " : "); searchLabel.setLabelFor(cardNameTxt); // Build the panel containing search label and card name text field final Box searchPanel = Box.createHorizontalBox(); searchPanel.add(searchLabel); searchPanel.add(cardNameTxt); searchPanel.setMaximumSize(new Dimension(32010, 26)); listScrollerLeft = new JScrollPane(leftList); MToolKit.addOverlay(listScrollerLeft); // Build the left panel containing : list, available amount, "Add" panel final JPanel srcPanel = new JPanel(null); srcPanel.add(searchPanel); srcPanel.add(listScrollerLeft); srcPanel.add(amountLeft); srcPanel.add(addPanel); srcPanel.setMinimumSize(new Dimension(220, 200)); srcPanel.setLayout(new BoxLayout(srcPanel, BoxLayout.Y_AXIS)); // Initialize constraints constraintsChecker = new ConstraintsChecker(); constraintsChecker.setBorder(new EtchedBorder()); final JScrollPane constraintsCheckerScroll = new JScrollPane(constraintsChecker); MToolKit.addOverlay(constraintsCheckerScroll); // create a pane with the oracle text for the present card oracleText = new JLabel(); oracleText.setPreferredSize(new Dimension(180, 200)); oracleText.setVerticalAlignment(SwingConstants.TOP); final JScrollPane oracle = new JScrollPane(oracleText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(oracle); // build some Pie Charts and a panel to display it initSets(); datasets = new ChartSets(); final JTabbedPane tabbedPane = new JTabbedPane(); for (ChartFilter filter : ChartFilter.values()) { final Dataset dataSet = filter.createDataSet(this); final JFreeChart chart = new JFreeChart(null, null, filter.createPlot(dataSet, painterMapper.get(filter)), false); datasets.addDataSet(filter, dataSet); ChartPanel pieChartPanel = new ChartPanel(chart, true); tabbedPane.add(pieChartPanel, filter.getTitle()); } // add the Constraints scroll panel and Oracle text Pane to the tabbedPane tabbedPane.add(constraintsCheckerScroll, LanguageManager.getString("db_constraints")); tabbedPane.add(oracle, LanguageManager.getString("db_text")); tabbedPane.setSelectedComponent(oracle); // The toollBar for color filtering toolBar = new JToolBar(); toolBar.setFloatable(false); final JButton clearButton = UIHelper.buildButton("clear"); clearButton.addActionListener(this); toolBar.add(clearButton); final JToggleButton toggleColorlessButton = new JToggleButton( UIHelper.getTbsIcon("mana/colorless/small/" + MdbLoader.unknownSmlMana), true); toggleColorlessButton.setActionCommand("0"); toggleColorlessButton.addActionListener(this); toolBar.add(toggleColorlessButton); for (int index = 1; index < IdCardColors.CARD_COLOR_NAMES.length; index++) { final JToggleButton toggleButton = new JToggleButton( UIHelper.getTbsIcon("mana/colored/small/" + MdbLoader.coloredSmlManas[index]), true); toggleButton.setActionCommand(String.valueOf(index)); toggleButton.addActionListener(this); toolBar.add(toggleButton); } // sorted card type combobox creation final List<String> idCards = new ArrayList<String>(Arrays.asList(CardFactory.exportedIdCardNames)); Collections.sort(idCards); final Object[] cardTypes = ArrayUtils.addAll(new String[] { LanguageManager.getString("db_types.any") }, idCards.toArray()); idCardComboBox = new JComboBox(cardTypes); idCardComboBox.setSelectedIndex(0); idCardComboBox.addActionListener(this); idCardComboBox.setActionCommand("cardTypeFilter"); // sorted card properties combobox creation final List<String> properties = new ArrayList<String>( CardFactory.getPropertiesName(DeckConstraints.getMinProperty(), DeckConstraints.getMaxProperty())); Collections.sort(properties); final Object[] cardProperties = ArrayUtils .addAll(new String[] { LanguageManager.getString("db_properties.any") }, properties.toArray()); propertiesComboBox = new JComboBox(cardProperties); propertiesComboBox.setSelectedIndex(0); propertiesComboBox.addActionListener(this); propertiesComboBox.setActionCommand("propertyFilter"); final JLabel colors = new JLabel(" " + LanguageManager.getString("colors") + " : "); final JLabel types = new JLabel(" " + LanguageManager.getString("types") + " : "); final JLabel property = new JLabel(" " + LanguageManager.getString("properties") + " : "); // filter Panel with colors toolBar and card type combobox final Box filterPanel = Box.createHorizontalBox(); filterPanel.add(colors); filterPanel.add(toolBar); filterPanel.add(types); filterPanel.add(idCardComboBox); filterPanel.add(property); filterPanel.add(propertiesComboBox); getContentPane().add(filterPanel, BorderLayout.NORTH); // Destination section : // Build the panel containing amount of available cards final JLabel rightAmount = new JLabel("0/?", SwingConstants.RIGHT); rightAmount.setMaximumSize(new Dimension(220, 26)); // Build the right list rightListModel = new MCardTableModel(new MListModel<MCardCompare>(rightAmount, true)); rightListModel.addTableModelListener(this); rightList = new JTable(rightListModel); rightList.setShowGrid(false); rightList.setTableHeader(null); rightList.getSelectionModel().addListSelectionListener(this); rightList.getColumnModel().getColumn(0).setMaxWidth(25); rightList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); // Build the panel containing the selected deck deckNameTxt = new JTextField("loading..."); deckNameTxt.setEditable(false); deckNameTxt.setBorder(null); final JLabel deckLabel = new JLabel(LanguageManager.getString("db_deck") + " : "); deckLabel.setLabelFor(deckNameTxt); final Box deckNamePanel = Box.createHorizontalBox(); deckNamePanel.add(deckLabel); deckNamePanel.add(deckNameTxt); deckNamePanel.setMaximumSize(new Dimension(220, 26)); // Initialize the text field containing the amount to remove removeQtyTxt = new JTextField("1"); // Build the "Remove" button removeButton = new JButton(LanguageManager.getString("db_remove")); removeButton.setMnemonic('r'); removeButton.addMouseListener(this); removeButton.setEnabled(false); // Build the panel containing : "Remove" amount and "Remove" button final Box removePanel = Box.createHorizontalBox(); removePanel.add(removeButton); removePanel.add(removeQtyTxt); removePanel.setMaximumSize(new Dimension(220, 26)); // Build the right panel containing : list, available amount, constraints final JScrollPane deskListScroller = new JScrollPane(rightList); MToolKit.addOverlay(deskListScroller); deskListScroller.setBorder(BorderFactory.createLineBorder(Color.GRAY)); deskListScroller.setMinimumSize(new Dimension(220, 200)); deskListScroller.setMaximumSize(new Dimension(220, 32000)); final Box destPanel = Box.createVerticalBox(); destPanel.add(deckNamePanel); destPanel.add(deskListScroller); destPanel.add(rightAmount); destPanel.add(removePanel); destPanel.setMinimumSize(new Dimension(220, 200)); destPanel.setMaximumSize(new Dimension(220, 32000)); // Build the panel containing the name of card in picture cardPictureNameTxt = new JLabel("<html><i>no selected card</i>"); final Box cardPictureNamePanel = Box.createHorizontalBox(); cardPictureNamePanel.add(cardPictureNameTxt); cardPictureNamePanel.setMaximumSize(new Dimension(32010, 26)); // Group the detail panels final JPanel viewCard = new JPanel(null); viewCard.add(cardPictureNamePanel); viewCard.add(CardView.getInstance()); viewCard.add(tabbedPane); viewCard.setLayout(new BoxLayout(viewCard, BoxLayout.Y_AXIS)); final Box mainPanel = Box.createHorizontalBox(); mainPanel.add(destPanel); mainPanel.add(viewCard); // Add the main panel getContentPane().add(srcPanel, BorderLayout.WEST); getContentPane().add(mainPanel, BorderLayout.CENTER); // Size this frame getRootPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT)); getRootPane().setMinimumSize(getRootPane().getPreferredSize()); pack(); }
From source file:cl.uai.webcursos.emarking.desktop.OptionsDialog.java
/** * Create the dialog.//from w w w. j av a2 s . c o m */ public OptionsDialog(Moodle _moodle) { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { cancelled = true; } }); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setIconImage(Toolkit.getDefaultToolkit().getImage(OptionsDialog.class .getResource("/cl/uai/webcursos/emarking/desktop/resources/glyphicons_439_wrench.png"))); setTitle(EmarkingDesktop.lang.getString("emarkingoptions")); setModal(true); setBounds(100, 100, 707, 444); this.moodle = _moodle; this.moodle.loadProperties(); getContentPane().setLayout(new BorderLayout()); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { okButton = new JButton(EmarkingDesktop.lang.getString("ok")); okButton.setEnabled(false); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); if (!validator.isValid(moodleurl.getText())) { throw new Exception(EmarkingDesktop.lang.getString("invalidmoodleurl") + " " + moodleurl.getText()); } File f = new File(filename.getText()); if (!f.exists() || f.isDirectory() || (!f.getPath().endsWith(".pdf") && !f.getPath().endsWith(".zip"))) { throw new Exception(EmarkingDesktop.lang.getString("invalidpdffile") + " " + filename.getText()); } if (omrtemplate.getText().trim().length() > 0) { File omrf = new File(omrtemplate.getText()); if (!omrf.exists() || omrf.isDirectory() || (!omrf.getPath().endsWith(".xtmpl"))) { throw new Exception(EmarkingDesktop.lang.getString("invalidomrfile") + " " + omrtemplate.getText()); } } moodle.setLastfile(filename.getText()); moodle.getQrExtractor().setDoubleside(chckbxDoubleSide.isSelected()); moodle.setMaxthreads(Integer.parseInt(getMaxThreads().getSelectedItem().toString())); moodle.setResolution(Integer.parseInt(getResolution().getSelectedItem().toString())); moodle.setMaxzipsize(getMaxZipSize().getSelectedItem().toString()); moodle.setOMRTemplate(omrtemplate.getText()); moodle.setThreshold(Integer.parseInt(spinnerOMRthreshold.getValue().toString())); moodle.setDensity(Integer.parseInt(spinnerOMRdensity.getValue().toString())); moodle.setShapeSize(Integer.parseInt(spinnerOMRshapeSize.getValue().toString())); moodle.setAnonymousPercentage( Integer.parseInt(spinnerAnonymousPercentage.getValue().toString())); moodle.setAnonymousPercentageCustomPage( Integer.parseInt(spinnerAnonymousPercentageCustomPage.getValue().toString())); moodle.setFakeStudents(chckbxMarkersTraining.isSelected()); moodle.saveProperties(); cancelled = false; setVisible(false); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(panel, EmarkingDesktop.lang.getString("invaliddatainform")); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(EmarkingDesktop.lang.getString("cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelled = true; setVisible(false); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); getContentPane().add(tabbedPane, BorderLayout.CENTER); panel = new JPanel(); tabbedPane.addTab(EmarkingDesktop.lang.getString("general"), null, panel, null); panel.setLayout(null); JPanel panel_2 = new JPanel(); panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_2.setBounds(10, 11, 665, 131); panel.add(panel_2); panel_2.setLayout(null); JLabel lblPassword = new JLabel(EmarkingDesktop.lang.getString("password")); lblPassword.setBounds(10, 99, 109, 14); panel_2.add(lblPassword); lblPassword.setHorizontalAlignment(SwingConstants.RIGHT); password = new JPasswordField(); password.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(); } }); password.setBounds(129, 96, 329, 20); panel_2.add(password); this.password.setText(this.moodle.getPassword()); btnTestConnection = new JButton(EmarkingDesktop.lang.getString("connect")); btnTestConnection.setEnabled(false); btnTestConnection.setBounds(468, 93, 172, 27); panel_2.add(btnTestConnection); username = new JTextField(); username.setBounds(129, 65, 329, 20); panel_2.add(username); username.setColumns(10); this.username.setText(this.moodle.getUsername()); moodleurl = new JTextField(); moodleurl.setBounds(129, 34, 329, 20); panel_2.add(moodleurl); moodleurl.setColumns(10); moodleurl.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { warn(); } @Override public void insertUpdate(DocumentEvent e) { warn(); } @Override public void changedUpdate(DocumentEvent e) { warn(); } private void warn() { UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); if (!validator.isValid(moodleurl.getText()) || !moodleurl.getText().endsWith("/")) { moodleurl.setForeground(Color.RED); btnTestConnection.setEnabled(false); } else { moodleurl.setForeground(Color.BLACK); btnTestConnection.setEnabled(true); } } }); // Initializing values from moodle configuration this.moodleurl.setText(this.moodle.getUrl()); JLabel lblMoodleUrl = new JLabel(EmarkingDesktop.lang.getString("moodleurl")); lblMoodleUrl.setBounds(10, 37, 109, 14); panel_2.add(lblMoodleUrl); lblMoodleUrl.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblUsername = new JLabel(EmarkingDesktop.lang.getString("username")); lblUsername.setBounds(10, 68, 109, 14); panel_2.add(lblUsername); lblUsername.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblMoodleSettings = new JLabel(EmarkingDesktop.lang.getString("moodlesettings")); lblMoodleSettings.setBounds(10, 11, 230, 14); panel_2.add(lblMoodleSettings); btnTestConnection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(); } }); JPanel panel_3 = new JPanel(); panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_3.setBounds(10, 159, 666, 174); panel.add(panel_3); panel_3.setLayout(null); JLabel lblPdfFile = new JLabel(EmarkingDesktop.lang.getString("pdffile")); lblPdfFile.setBounds(0, 39, 119, 14); panel_3.add(lblPdfFile); lblPdfFile.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblScanned = new JLabel(EmarkingDesktop.lang.getString("scanned")); lblScanned.setBounds(0, 64, 119, 14); panel_3.add(lblScanned); lblScanned.setHorizontalAlignment(SwingConstants.RIGHT); chckbxDoubleSide = new JCheckBox(EmarkingDesktop.lang.getString("doubleside")); chckbxDoubleSide.setEnabled(false); chckbxDoubleSide.setBounds(125, 60, 333, 23); panel_3.add(chckbxDoubleSide); chckbxDoubleSide.setToolTipText(EmarkingDesktop.lang.getString("doublesidetooltip")); this.chckbxDoubleSide.setSelected(this.moodle.getQrExtractor().isDoubleside()); filename = new JTextField(); filename.setEnabled(false); filename.setBounds(129, 36, 329, 20); panel_3.add(filename); filename.setColumns(10); filename.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { warn(); } @Override public void insertUpdate(DocumentEvent e) { warn(); } @Override public void changedUpdate(DocumentEvent e) { warn(); } private void warn() { validateFileForProcessing(!btnTestConnection.isEnabled()); } }); this.filename.setText(this.moodle.getLastfile()); btnOpenPdfFile = new JButton(EmarkingDesktop.lang.getString("openfile")); btnOpenPdfFile.setEnabled(false); btnOpenPdfFile.setBounds(468, 33, 172, 27); panel_3.add(btnOpenPdfFile); JLabel lblPdfFileSettings = new JLabel(EmarkingDesktop.lang.getString("filesettings")); lblPdfFileSettings.setBounds(10, 11, 230, 14); panel_3.add(lblPdfFileSettings); JLabel lblOMRtemplate = new JLabel(EmarkingDesktop.lang.getString("omrfile")); lblOMRtemplate.setHorizontalAlignment(SwingConstants.RIGHT); lblOMRtemplate.setBounds(0, 142, 119, 14); panel_3.add(lblOMRtemplate); omrtemplate = new JTextField(); omrtemplate.setEnabled(false); omrtemplate.setText((String) null); omrtemplate.setColumns(10); omrtemplate.setBounds(129, 139, 329, 20); panel_3.add(omrtemplate); omrtemplate.setText(this.moodle.getOMRTemplate()); btnOpenOMRTemplate = new JButton(EmarkingDesktop.lang.getString("openomrfile")); btnOpenOMRTemplate.setEnabled(false); btnOpenOMRTemplate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle")); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "*.xtmpl"; } @Override public boolean accept(File arg0) { if (arg0.getName().endsWith(".xtmpl") || arg0.isDirectory()) return true; return false; } }); int retval = chooser.showOpenDialog(panel); if (retval == JFileChooser.APPROVE_OPTION) { omrtemplate.setText(chooser.getSelectedFile().getAbsolutePath()); } else { return; } } }); btnOpenOMRTemplate.setBounds(468, 136, 172, 27); panel_3.add(btnOpenOMRTemplate); lblMarkersTraining = new JLabel((String) EmarkingDesktop.lang.getString("markerstraining")); lblMarkersTraining.setHorizontalAlignment(SwingConstants.RIGHT); lblMarkersTraining.setBounds(0, 89, 119, 14); panel_3.add(lblMarkersTraining); chckbxMarkersTraining = new JCheckBox(EmarkingDesktop.lang.getString("markerstrainingfakestudents")); chckbxMarkersTraining.setBounds(125, 87, 333, 23); panel_3.add(chckbxMarkersTraining); btnOpenPdfFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButton.setEnabled(false); JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle(EmarkingDesktop.lang.getString("openfiletitle")); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "*.pdf, *.zip"; } @Override public boolean accept(File arg0) { if (arg0.getName().endsWith(".zip") || arg0.getName().endsWith(".pdf") || arg0.isDirectory()) return true; return false; } }); int retval = chooser.showOpenDialog(panel); if (retval == JFileChooser.APPROVE_OPTION) { filename.setText(chooser.getSelectedFile().getAbsolutePath()); okButton.setEnabled(true); } else { return; } } }); JPanel panel_1 = new JPanel(); tabbedPane.addTab(EmarkingDesktop.lang.getString("advanced"), null, panel_1, null); panel_1.setLayout(null); JPanel panel_4 = new JPanel(); panel_4.setLayout(null); panel_4.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_4.setBounds(10, 11, 665, 131); panel_1.add(panel_4); JLabel lblAdvancedOptions = new JLabel(EmarkingDesktop.lang.getString("advancedoptions")); lblAdvancedOptions.setBounds(10, 11, 233, 14); panel_4.add(lblAdvancedOptions); JLabel lblThreads = new JLabel(EmarkingDesktop.lang.getString("maxthreads")); lblThreads.setBounds(10, 38, 130, 14); panel_4.add(lblThreads); lblThreads.setHorizontalAlignment(SwingConstants.RIGHT); JLabel lblSomething = new JLabel(EmarkingDesktop.lang.getString("separatezipfiles")); lblSomething.setBounds(10, 73, 130, 14); panel_4.add(lblSomething); lblSomething.setHorizontalAlignment(SwingConstants.RIGHT); JLabel label = new JLabel(EmarkingDesktop.lang.getString("resolution")); label.setBounds(10, 105, 130, 14); panel_4.add(label); label.setHorizontalAlignment(SwingConstants.RIGHT); resolution = new JComboBox<Integer>(); resolution.setBounds(150, 99, 169, 27); panel_4.add(resolution); resolution.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 75, 100, 150, 300, 400, 500, 600 })); resolution.setSelectedIndex(2); this.resolution.setSelectedItem(this.moodle.getQrExtractor().getResolution()); maxZipSize = new JComboBox<String>(); maxZipSize.setBounds(150, 67, 169, 27); panel_4.add(maxZipSize); maxZipSize.setModel(new DefaultComboBoxModel<String>(new String[] { "<dynamic>", "2Mb", "4Mb", "8Mb", "16Mb", "32Mb", "64Mb", "128Mb", "256Mb", "512Mb", "1024Mb" })); maxZipSize.setSelectedIndex(6); this.maxZipSize.setSelectedItem(this.moodle.getMaxZipSizeString()); maxThreads = new JComboBox<Integer>(); maxThreads.setBounds(150, 32, 169, 27); panel_4.add(maxThreads); maxThreads.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 2, 4, 8, 16 })); maxThreads.setSelectedIndex(1); this.maxThreads.setSelectedItem(this.moodle.getQrExtractor().getMaxThreads()); JPanel panel_5 = new JPanel(); panel_5.setLayout(null); panel_5.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); panel_5.setBounds(10, 153, 665, 131); panel_1.add(panel_5); JLabel lblOMRoptions = new JLabel(EmarkingDesktop.lang.getString("omroptions")); lblOMRoptions.setBounds(10, 11, 233, 14); panel_5.add(lblOMRoptions); JLabel lblOMRthreshold = new JLabel(EmarkingDesktop.lang.getString("omrthreshold")); lblOMRthreshold.setHorizontalAlignment(SwingConstants.RIGHT); lblOMRthreshold.setBounds(10, 32, 130, 14); panel_5.add(lblOMRthreshold); JLabel lblShapeSize = new JLabel(EmarkingDesktop.lang.getString("omrshapesize")); lblShapeSize.setHorizontalAlignment(SwingConstants.RIGHT); lblShapeSize.setBounds(10, 99, 130, 14); panel_5.add(lblShapeSize); JLabel lblDensity = new JLabel(EmarkingDesktop.lang.getString("omrdensity")); lblDensity.setHorizontalAlignment(SwingConstants.RIGHT); lblDensity.setBounds(10, 70, 130, 14); panel_5.add(lblDensity); spinnerOMRthreshold = new JSpinner(); spinnerOMRthreshold.setBounds(150, 32, 169, 20); panel_5.add(spinnerOMRthreshold); spinnerOMRthreshold.setValue(this.moodle.getOMRthreshold()); spinnerOMRdensity = new JSpinner(); spinnerOMRdensity.setBounds(150, 67, 169, 20); panel_5.add(spinnerOMRdensity); spinnerOMRdensity.setValue(this.moodle.getOMRdensity()); spinnerOMRshapeSize = new JSpinner(); spinnerOMRshapeSize.setBounds(150, 99, 169, 20); panel_5.add(spinnerOMRshapeSize); spinnerOMRshapeSize.setValue(this.moodle.getOMRshapeSize()); JLabel lblAnonymousPercentage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouspercentage") + "</html>"); lblAnonymousPercentage.setHorizontalAlignment(SwingConstants.RIGHT); lblAnonymousPercentage.setBounds(329, 32, 130, 27); panel_5.add(lblAnonymousPercentage); spinnerAnonymousPercentage = new JSpinner(); spinnerAnonymousPercentage.setBounds(469, 32, 169, 20); panel_5.add(spinnerAnonymousPercentage); spinnerAnonymousPercentage.setValue(this.moodle.getAnonymousPercentage()); JLabel lblAnonymousPercentageCustomPage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouspercentagecustompage") + "</html>"); lblAnonymousPercentageCustomPage.setHorizontalAlignment(SwingConstants.RIGHT); lblAnonymousPercentageCustomPage.setBounds(329, 70, 130, 27); panel_5.add(lblAnonymousPercentageCustomPage); spinnerAnonymousPercentageCustomPage = new JSpinner(); spinnerAnonymousPercentageCustomPage.setBounds(469, 70, 169, 20); panel_5.add(spinnerAnonymousPercentageCustomPage); spinnerAnonymousPercentageCustomPage.setValue(this.moodle.getAnonymousPercentageCustomPage()); JLabel lblCustomPage = new JLabel( "<html>" + EmarkingDesktop.lang.getString("anonymouscustompage") + "</html>"); lblCustomPage.setHorizontalAlignment(SwingConstants.RIGHT); lblCustomPage.setBounds(329, 99, 130, 27); panel_5.add(lblCustomPage); spinnerCustomPage = new JSpinner(); spinnerCustomPage.setBounds(469, 99, 169, 20); panel_5.add(spinnerCustomPage); spinnerCustomPage.setValue(this.moodle.getAnonymousCustomPage()); }
From source file:au.org.ala.delta.editor.ui.image.ImageSettingsDialog.java
private void createUI() { JPanel overlayDefaultsPanel = new JPanel(); String overlayDefaultsTitle = _resources.getString("imageSettingsOverlayDefaults.title"); overlayDefaultsPanel.setBorder(/*from w w w. j a v a 2 s . co m*/ new TitledBorder(null, overlayDefaultsTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null)); JPanel imagePathPanel = new JPanel(); String imagePathTitle = _resources.getString("imageSettingsImagePath.title"); imagePathPanel.setBorder( new TitledBorder(null, imagePathTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null)); JPanel overlayFontDefaultsPanel = new JPanel(); String overlayFontTitle = _resources.getString("imageSettingsOverlayFonts.title"); overlayFontDefaultsPanel.setBorder( new TitledBorder(null, overlayFontTitle, TitledBorder.LEADING, TitledBorder.TOP, null, null)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup().addContainerGap() .addComponent(overlayDefaultsPanel, GroupLayout.PREFERRED_SIZE, 236, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 685, Short.MAX_VALUE) .addComponent(overlayFontDefaultsPanel, GroupLayout.DEFAULT_SIZE, 685, Short.MAX_VALUE) .addComponent(imagePathPanel, GroupLayout.DEFAULT_SIZE, 685, Short.MAX_VALUE)) .addContainerGap())); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup().addGap(10) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) .addComponent(overlayDefaultsPanel, 0, 0, Short.MAX_VALUE) .addGroup(groupLayout.createSequentialGroup() .addComponent(imagePathPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(overlayFontDefaultsPanel, GroupLayout.PREFERRED_SIZE, 260, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(ComponentPlacement.RELATED).addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); btnOk = new JButton("Ok"); buttonPanel.add(btnOk); btnCancel = new JButton("Cancel"); buttonPanel.add(btnCancel); btnApply = new JButton("Apply"); btnApply.setHorizontalAlignment(SwingConstants.RIGHT); buttonPanel.add(btnApply); chckbxCentreInBox = new JCheckBox(); chckbxCentreInBox.setName("imageSettingsCentreInBox"); chckbxIncludeComments = new JCheckBox(); chckbxIncludeComments.setName("imageSettingsIncludeComments"); chckbxOmitDescription = new JCheckBox(); chckbxOmitDescription.setName("imageSettingsOmitDescription"); chckbxUseIntegralHeight = new JCheckBox(); chckbxUseIntegralHeight.setName("imageSettingsUseIntegralHeight"); chckbxHotspotsPopUp = new JCheckBox(); chckbxHotspotsPopUp.setName("imageSettingsHotspotsPopUp"); chckbxCustomPopupColour = new JCheckBox(); chckbxCustomPopupColour.setName("imageSettingsCustomPopupColour"); JPanel panel = new JPanel(); selectedColourLabel = new JLabel(""); selectedColourLabel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); selectedColourLabel.setPreferredSize(new Dimension(25, 25)); selectedColourLabel.setOpaque(true); selectedColourLabel.setEnabled(false); chooseColourButton = new JButton(); chooseColourButton.setEnabled(false); JLabel lblButtonAlignment = new JLabel(); lblButtonAlignment.setName("imageSettingsButtonAlignment"); buttonAlignmentCombo = new JComboBox(); buttonAlignmentCombo.setModel(new ButtonAlignmentModel()); buttonAlignmentCombo.setRenderer(new ButtonAlignmentRenderer()); GroupLayout gl_overlayDefaultsPanel = new GroupLayout(overlayDefaultsPanel); gl_overlayDefaultsPanel.setHorizontalGroup(gl_overlayDefaultsPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayDefaultsPanel.createSequentialGroup().addContainerGap() .addGroup(gl_overlayDefaultsPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayDefaultsPanel.createSequentialGroup().addGap(6) .addComponent(lblButtonAlignment)) .addComponent(chckbxIncludeComments).addComponent(chckbxOmitDescription) .addComponent(chckbxUseIntegralHeight).addComponent(chckbxHotspotsPopUp) .addComponent(chckbxCustomPopupColour) .addComponent(buttonAlignmentCombo, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 193, GroupLayout.PREFERRED_SIZE) .addComponent(chckbxCentreInBox)) .addContainerGap(25, Short.MAX_VALUE))); gl_overlayDefaultsPanel .setVerticalGroup(gl_overlayDefaultsPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayDefaultsPanel.createSequentialGroup().addGap(10) .addComponent(chckbxCentreInBox).addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxIncludeComments).addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxOmitDescription).addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxUseIntegralHeight).addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxHotspotsPopUp).addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxCustomPopupColour).addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE) .addGap(12).addComponent(lblButtonAlignment) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(buttonAlignmentCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(144, Short.MAX_VALUE))); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addComponent(selectedColourLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(chooseColourButton).addGap(68))); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(chooseColourButton) .addComponent(selectedColourLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel.setLayout(gl_panel); overlayDefaultsPanel.setLayout(gl_overlayDefaultsPanel); JLabel lblFontName = new JLabel(); lblFontName.setName("imageSettingsFontName"); JLabel lblSize = new JLabel(); lblSize.setName("imageSettingsFontSize"); JLabel lblBold = new JLabel(); lblBold.setName("imageSettingsFontBold"); JLabel lblItalic = new JLabel(); lblItalic.setName("imageSettingsFontItalic"); JLabel featureLabel = new JLabel(); featureLabel.setName("imageSettingsFeatureFont"); buttonFontCombo = new JComboBox(); buttonFontCombo.setModel(new FontFamilyModel()); featureSizeCombo = new JComboBox(); featureSizeCombo.setModel(new FontSizeModel()); buttonBoldCheckBox = new JCheckBox(""); featureItalicCheckBox = new JCheckBox(""); JLabel buttonLabel = new JLabel(); buttonLabel.setName("imageSettingsButtonFont"); featureFontCombo = new JComboBox(); featureFontCombo.setModel(new FontFamilyModel()); buttonSizeCombo = new JComboBox(); buttonSizeCombo.setModel(new FontSizeModel()); featureBoldCheckBox = new JCheckBox(""); buttonItalicCheckBox = new JCheckBox(""); JLabel defaultLabel = new JLabel(); defaultLabel.setName("imageSettingsDefaultFont"); defaultFontCombo = new JComboBox(); defaultFontCombo.setModel(new FontFamilyModel()); defaultSizeCombo = new JComboBox(); defaultSizeCombo.setModel(new FontSizeModel()); defaultBoldCheckBox = new JCheckBox(""); defaultItalicCheckBox = new JCheckBox(""); JLabel lblSample = new JLabel(); lblSample.setName("imageSettingsSample"); sampleTextField = new JTextField(""); chckbxSaveSampleAs = new JCheckBox(); chckbxSaveSampleAs.setSelected(true); chckbxSaveSampleAs.setName("imageSettingsSaveSampleAs"); GroupLayout gl_overlayFontDefaultsPanel = new GroupLayout(overlayFontDefaultsPanel); gl_overlayFontDefaultsPanel.setHorizontalGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup().addContainerGap() .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup() .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING) .addComponent(defaultLabel).addComponent(featureLabel) .addComponent(buttonLabel)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.TRAILING) .addComponent(lblFontName, 0, 345, Short.MAX_VALUE) .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup() .addGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.TRAILING) .addComponent(defaultFontCombo, Alignment.LEADING, 0, 339, Short.MAX_VALUE) .addComponent(featureFontCombo, 0, 339, Short.MAX_VALUE) .addComponent(buttonFontCombo, 0, 339, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED))) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING) .addComponent(lblSize, 0, 94, Short.MAX_VALUE) .addComponent(defaultSizeCombo, 0, 94, Short.MAX_VALUE) .addComponent(featureSizeCombo, 0, 94, Short.MAX_VALUE) .addComponent(buttonSizeCombo, 0, 94, Short.MAX_VALUE))) .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup() .addComponent(lblSample).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING) .addComponent(chckbxSaveSampleAs).addComponent(sampleTextField, GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)))) .addGap(18) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING, false) .addComponent(featureBoldCheckBox, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addComponent(defaultBoldCheckBox, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addComponent(buttonBoldCheckBox, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addComponent(lblBold, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.TRAILING) .addComponent(buttonItalicCheckBox, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addComponent(featureItalicCheckBox, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addComponent(lblItalic, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) .addComponent(defaultItalicCheckBox, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); gl_overlayFontDefaultsPanel .setVerticalGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.LEADING).addGroup(gl_overlayFontDefaultsPanel .createSequentialGroup().addContainerGap().addGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.BASELINE).addComponent( lblSize) .addComponent(lblFontName).addComponent(lblItalic).addComponent(lblBold)) .addGap(10) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup( Alignment.BASELINE) .addComponent(defaultFontCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(defaultSizeCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(defaultLabel)) .addComponent(defaultItalicCheckBox).addComponent(defaultBoldCheckBox)) .addGap(10) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.BASELINE) .addComponent(featureFontCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(featureSizeCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(featureLabel)) .addComponent(featureItalicCheckBox).addComponent(featureBoldCheckBox)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_overlayFontDefaultsPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_overlayFontDefaultsPanel.createSequentialGroup() .addGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.BASELINE) .addComponent(buttonSizeCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonFontCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonLabel)) .addGap(18) .addGroup(gl_overlayFontDefaultsPanel .createParallelGroup(Alignment.BASELINE) .addComponent(sampleTextField, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addComponent(lblSample)) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(chckbxSaveSampleAs)) .addComponent(buttonItalicCheckBox).addComponent(buttonBoldCheckBox)) .addContainerGap(16, Short.MAX_VALUE))); overlayFontDefaultsPanel.setLayout(gl_overlayFontDefaultsPanel); imagePathTextField = new JTextField(); imagePathTextField.setColumns(10); imagePathButton = new JButton("New button"); GroupLayout gl_imagePathPanel = new GroupLayout(imagePathPanel); gl_imagePathPanel.setHorizontalGroup(gl_imagePathPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_imagePathPanel.createSequentialGroup().addContainerGap() .addComponent(imagePathTextField, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(imagePathButton))); gl_imagePathPanel.setVerticalGroup(gl_imagePathPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_imagePathPanel.createSequentialGroup().addContainerGap() .addGroup(gl_imagePathPanel.createParallelGroup(Alignment.BASELINE) .addComponent(imagePathTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(imagePathButton)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); imagePathPanel.setLayout(gl_imagePathPanel); getContentPane().setLayout(groupLayout); }
From source file:ca.phon.app.session.editor.view.session_information.SessionInfoEditorView.java
private void init() { setLayout(new BorderLayout()); contentPanel = new TierDataLayoutPanel(); dateField = createDateField();//from w w w . ja va 2s . c o m dateField.getTextField().setColumns(10); dateField.setBackground(Color.white); mediaLocationField = new MediaSelectionField(getEditor().getProject()); mediaLocationField.setEditor(getEditor()); mediaLocationField.getTextField().setColumns(10); mediaLocationField.addPropertyChangeListener(FileSelectionField.FILE_PROP, mediaLocationListener); participantTable = new JXTable(); participantTable.setVisibleRowCount(3); ComponentInputMap participantTableInputMap = new ComponentInputMap(participantTable); ActionMap participantTableActionMap = new ActionMap(); ImageIcon deleteIcon = IconManager.getInstance().getIcon("actions/delete_user", IconSize.SMALL); final PhonUIAction deleteAction = new PhonUIAction(this, "deleteParticipant"); deleteAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Delete selected participant"); deleteAction.putValue(PhonUIAction.SMALL_ICON, deleteIcon); participantTableActionMap.put("DELETE_PARTICIPANT", deleteAction); participantTableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "DELETE_PARTICIPANT"); participantTableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "DELETE_PARTICIPANT"); removeParticipantButton = new JButton(deleteAction); participantTable.setInputMap(WHEN_FOCUSED, participantTableInputMap); participantTable.setActionMap(participantTableActionMap); addParticipantButton = new JButton(new NewParticipantAction(getEditor(), this)); addParticipantButton.setFocusable(false); ImageIcon editIcon = IconManager.getInstance().getIcon("actions/edit_user", IconSize.SMALL); final PhonUIAction editParticipantAct = new PhonUIAction(this, "editParticipant"); editParticipantAct.putValue(PhonUIAction.NAME, "Edit participant..."); editParticipantAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Edit selected participant..."); editParticipantAct.putValue(PhonUIAction.SMALL_ICON, editIcon); editParticipantButton = new JButton(editParticipantAct); editParticipantButton.setFocusable(false); final CellConstraints cc = new CellConstraints(); FormLayout participantLayout = new FormLayout("fill:pref:grow, pref, pref, pref", "pref, pref, pref:grow"); JPanel participantPanel = new JPanel(participantLayout); participantPanel.setBackground(Color.white); participantPanel.add(new JScrollPane(participantTable), cc.xywh(1, 2, 3, 2)); participantPanel.add(addParticipantButton, cc.xy(2, 1)); participantPanel.add(editParticipantButton, cc.xy(3, 1)); participantPanel.add(removeParticipantButton, cc.xy(4, 2)); participantTable.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent arg0) { if (arg0.getClickCount() == 2 && arg0.getButton() == MouseEvent.BUTTON1) { editParticipantAct.actionPerformed(new ActionEvent(arg0.getSource(), arg0.getID(), "edit")); } } }); languageField = new LanguageField(); languageField.getDocument().addDocumentListener(languageFieldListener); int rowIdx = 0; final JLabel dateLbl = new JLabel("Session Date"); dateLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(dateLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(dateField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); final JLabel mediaLbl = new JLabel("Media"); mediaLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(mediaLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(mediaLocationField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); final JLabel partLbl = new JLabel("Participants"); partLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(partLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(participantPanel, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); final JLabel langLbl = new JLabel("Language"); langLbl.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(langLbl, new TierDataConstraint(TierDataConstraint.TIER_LABEL_COLUMN, rowIdx)); contentPanel.add(languageField, new TierDataConstraint(TierDataConstraint.FLAT_TIER_COLUMN, rowIdx++)); add(new JScrollPane(contentPanel), BorderLayout.CENTER); update(); }
From source file:eu.dety.burp.joseph.attacks.bleichenbacher_pkcs1.gui.BleichenbacherPkcs1DecryptionAttackPanel.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. *///from ww w . j a va 2 s. c o m @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { cekFormatButtonGroup = new javax.swing.ButtonGroup(); startAttackButton = new javax.swing.JButton(); cancelAttackButton = new javax.swing.JButton(); jSeparator1 = new javax.swing.JSeparator(); timeElapsedLabel = new javax.swing.JLabel(); amountRequestsLabel = new javax.swing.JLabel(); currentSLabel = new javax.swing.JLabel(); resultKeyLabel = new javax.swing.JLabel(); cekFormatHex = new javax.swing.JRadioButton(); cekFormatB64 = new javax.swing.JRadioButton(); attackDescription = new javax.swing.JLabel(); timeElapsedValue = new javax.swing.JLabel(); amountRequestsValue = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); currentSValue = new javax.swing.JTextArea(); jScrollPane2 = new javax.swing.JScrollPane(); resultContentValue = new javax.swing.JTextArea(); resultContentLabel = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); resultKeyValue = new javax.swing.JTextArea(); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("JOSEPH"); // NOI18N startAttackButton.setText(bundle.getString("STARTATTACKBUTTON")); // NOI18N startAttackButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { startAttackButtonActionPerformed(evt); } }); cancelAttackButton.setText(bundle.getString("CANCELATTACKBUTTON")); // NOI18N cancelAttackButton.setEnabled(false); cancelAttackButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelAttackButtonActionPerformed(evt); } }); timeElapsedLabel.setText(bundle.getString("TIME_ELAPSED")); // NOI18N amountRequestsLabel.setText(bundle.getString("AMOUNT_REQUESTS")); // NOI18N currentSLabel.setText(bundle.getString("FOUND_S")); // NOI18N resultKeyLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N resultKeyLabel.setText(bundle.getString("RESULT_CEK")); // NOI18N cekFormatButtonGroup.add(cekFormatHex); cekFormatHex.setSelected(true); cekFormatHex.setText(bundle.getString("HEX")); // NOI18N cekFormatHex.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cekFormatHexActionPerformed(evt); } }); cekFormatButtonGroup.add(cekFormatB64); cekFormatB64.setText(bundle.getString("BASE64URL")); // NOI18N cekFormatB64.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cekFormatB64ActionPerformed(evt); } }); attackDescription.setText( "<html><em>Note: This attack will take several minutes and performs thousands of requests to the server!</em><br />This attack is only successful, if the valid oracle responses are correctly marked.</html>"); timeElapsedValue.setText("00:00:00"); timeElapsedValue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); amountRequestsValue.setText("0"); amountRequestsValue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); jScrollPane1.setBackground(new java.awt.Color(251, 251, 251)); jScrollPane1.setBorder(null); jScrollPane1.setForeground(new java.awt.Color(0, 0, 0)); currentSValue.setEditable(false); currentSValue.setBackground(new java.awt.Color(251, 251, 251)); currentSValue.setColumns(20); currentSValue.setForeground(new java.awt.Color(0, 0, 0)); currentSValue.setLineWrap(true); currentSValue.setRows(4); currentSValue.setTabSize(4); currentSValue.setText("0"); currentSValue.setWrapStyleWord(true); currentSValue.setBorder(null); jScrollPane1.setViewportView(currentSValue); jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); resultContentValue.setEditable(false); resultContentValue.setColumns(20); resultContentValue.setLineWrap(true); resultContentValue.setRows(5); resultContentValue.setWrapStyleWord(true); resultContentValue.setBorder(null); jScrollPane2.setViewportView(resultContentValue); resultContentLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N resultContentLabel.setText(bundle.getString("RESULT_CONTENT")); // NOI18N jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); resultKeyValue.setEditable(false); resultKeyValue.setColumns(20); resultKeyValue.setLineWrap(true); resultKeyValue.setRows(5); resultKeyValue.setWrapStyleWord(true); resultKeyValue.setBorder(null); jScrollPane3.setViewportView(resultKeyValue); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(attackDescription, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 922, Short.MAX_VALUE) .addComponent(jSeparator1) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(startAttackButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cancelAttackButton)) .addGroup(layout.createSequentialGroup().addComponent(cekFormatHex) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(cekFormatB64)) .addComponent(resultKeyLabel) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(currentSLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(amountRequestsLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(timeElapsedLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(timeElapsedValue, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE) .addComponent(amountRequestsValue, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING))) .addComponent(resultContentLabel)).addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) .addGroup(layout.createSequentialGroup().addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 700, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 700, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(attackDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(startAttackButton).addComponent(cancelAttackButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(timeElapsedLabel).addComponent(timeElapsedValue)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(amountRequestsLabel).addComponent(amountRequestsValue)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(currentSLabel).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(resultKeyLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(cekFormatHex).addComponent(cekFormatB64)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(resultContentLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(68, Short.MAX_VALUE))); }