/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user changed the service filter option if (e.getSource() == service_box) { service_list.setEnabled(service_box.isSelected()); service_list.clearSelection(); remove_service_button.setEnabled(false); add_service_field.setEnabled(service_box.isSelected()); add_service_field.setText(""); add_service_button.setEnabled(false); } // Check if the user pressed the add service button if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) { String text = add_service_field.getText(); if ((text != null) && (text.length() > 0)) { service_data.addElement(text); service_list.setListData(service_data); } add_service_field.setText(""); add_service_field.requestFocus(); } // Check if the user pressed the remove service button if (e.getSource() == remove_service_button) { Object[] sels = service_list.getSelectedValues(); for (int i = 0; i < sels.length; i++) { service_data.removeElement(sels[i]); } service_list.setListData(service_data); service_list.clearSelection(); } }
/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user pressed the ok button if (e.getSource() == ok_button) { filter_include_list = include_panel.getServiceList(); filter_exclude_list = exclude_panel.getServiceList(); if (status_box.isSelected()) { filter_active = status_active.isSelected(); filter_complete = status_complete.isSelected(); } else { filter_active = false; filter_complete = false; } ok_pressed = true; dialog.dispose(); } // Check if the user pressed the cancel button if (e.getSource() == cancel_button) { dialog.dispose(); } // Check if the user changed the status filter option if (e.getSource() == status_box) { status_active.setEnabled(status_box.isSelected()); status_complete.setEnabled(status_box.isSelected()); } }
@Override public void onExit() { // save all painters for (EntryListPanel panel : listPanelSet) { myjava.gui.syntax.Painter painter = panel.getPainter(); if (!painter.equals(myjava.gui.syntax.Painter.getDefaultInstance())) { myjava.gui.syntax.Painter.add(painter); setConfig("painter.userDefined." + painter.getName(), painter.toWritableString()); } if (painter.equals(painterComboBox.getSelectedItem())) { // selected painter setConfig("syntax.selectedPainter", painter.getName()); myjava.gui.syntax.Painter.setCurrentInstance(painter); } } // remove "removed painters" for (myjava.gui.syntax.Painter removed : removedPainters) { removeConfig0("painter.userDefined." + removed.getName()); myjava.gui.syntax.Painter.remove(removed); } // highlight? boolean _highlightSyntax = highlightSyntax.isSelected(); boolean _matchBracket = matchBracket.isSelected(); MyUmbrellaLayerUI.setHighlightingStatus(_highlightSyntax, _matchBracket); setConfig("syntax.highlight", _highlightSyntax + ""); setConfig("syntax.matchBrackets", _matchBracket + ""); }
/* * Gets the user choice for font, style and size and redraws the text * accordingly. */ public void setSampleFont() { // Get the font name from the JComboBox fontName = (String) facenameCombo.getSelectedItem(); sampleField.setText(textField.getText()); // Get the font style from the JCheckBoxes fontStyle = 0; if (italicCheckBox.isSelected()) fontStyle += Font.ITALIC; if (boldCheckBox.isSelected()) fontStyle += Font.BOLD; // Get the font size fontSize = 0; fontSize = Integer.parseInt((String) sizeCombo.getSelectedItem()); // THE FOLLOWING IS NO LONGER NEEDED // if(smallButton.isSelected()) // fontSize=SMALL; // else if(mediumButton.isSelected()) // fontSize=MEDIUM; // else if(largeButton.isSelected()) // fontSize=LARGE; // Set the font of the text field sampleField.setFont(new Font(fontName, fontStyle, fontSize)); sampleField.setForeground(fontColor); sampleField.repaint(); pack(); } // end setSampleFont method
/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user pressed the remove button if (e.getSource() == remove_button) { int row = table.getSelectedRow(); model.removeRow(row); table.clearSelection(); table.repaint(); valueChanged(null); } // Check if the user pressed the remove all button if (e.getSource() == remove_all_button) { model.clearAll(); table.setRowSelectionInterval(0, 0); table.repaint(); valueChanged(null); } // Check if the user pressed the filter button if (e.getSource() == filter_button) { filter.showDialog(); if (filter.okPressed()) { // Update the display with new filter model.setFilter(filter); table.repaint(); } } // Check if the user pressed the start button if (e.getSource() == start_button) { start(); } // Check if the user pressed the stop button if (e.getSource() == stop_button) { stop(); } // Check if the user wants to switch layout if (e.getSource() == layout_button) { details_panel.remove(details_soap); details_soap.removeAll(); if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT); } else { details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); } details_soap.setTopComponent(request_panel); details_soap.setRightComponent(response_panel); details_soap.setResizeWeight(.5); details_panel.add(details_soap, BorderLayout.CENTER); details_panel.validate(); details_panel.repaint(); } // Check if the user is changing the reflow option if (e.getSource() == reflow_xml) { request_text.setReflowXML(reflow_xml.isSelected()); response_text.setReflowXML(reflow_xml.isSelected()); } }
/** * Saves the user input when the "Next" wizard buttons is clicked. * * @param registration the SIPAccountRegistration * @return */ public boolean commitPanel(SecurityAccountRegistration registration) { registration.setDefaultEncryption(enableDefaultEncryption.isSelected()); registration.setEncryptionProtocols(encryptionConfigurationTableModel.getEncryptionProtocols()); registration.setEncryptionProtocolStatus( encryptionConfigurationTableModel.getEncryptionProtocolStatus()); registration.setSipZrtpAttribute(enableSipZrtpAttribute.isSelected()); registration.setSavpOption(((SavpOption) cboSavpOption.getSelectedItem()).option); registration.setSDesCipherSuites(cipherModel.getEnabledCiphers()); return true; }
/** Constructor */ public ServiceFilterPanel(String text, Vector list) { empty_border = new EmptyBorder(5, 5, 0, 5); indent_border = new EmptyBorder(5, 25, 5, 5); service_box = new JCheckBox(text); service_box.addActionListener(this); service_data = new Vector(); if (list != null) { service_box.setSelected(true); service_data = (Vector) list.clone(); } service_list = new JList(service_data); service_list.setBorder(new EtchedBorder()); service_list.setVisibleRowCount(5); service_list.addListSelectionListener(this); service_list.setEnabled(service_box.isSelected()); service_scroll = new JScrollPane(service_list); service_scroll.setBorder(new EtchedBorder()); remove_service_button = new JButton("Remove"); remove_service_button.addActionListener(this); remove_service_button.setEnabled(false); remove_service_panel = new JPanel(); remove_service_panel.setLayout(new FlowLayout()); remove_service_panel.add(remove_service_button); service_area = new JPanel(); service_area.setLayout(new BorderLayout()); service_area.add(service_scroll, BorderLayout.CENTER); service_area.add(remove_service_panel, BorderLayout.EAST); service_area.setBorder(indent_border); add_service_field = new JTextField(); add_service_field.addActionListener(this); add_service_field.getDocument().addDocumentListener(this); add_service_field.setEnabled(service_box.isSelected()); add_service_button = new JButton("Add"); add_service_button.addActionListener(this); add_service_button.setEnabled(false); add_service_panel = new JPanel(); add_service_panel.setLayout(new BorderLayout()); JPanel dummy = new JPanel(); dummy.setBorder(empty_border); add_service_panel.add(dummy, BorderLayout.WEST); add_service_panel.add(add_service_button, BorderLayout.EAST); add_service_area = new JPanel(); add_service_area.setLayout(new BorderLayout()); add_service_area.add(add_service_field, BorderLayout.CENTER); add_service_area.add(add_service_panel, BorderLayout.EAST); add_service_area.setBorder(indent_border); setLayout(new BorderLayout()); add(service_box, BorderLayout.NORTH); add(service_area, BorderLayout.CENTER); add(add_service_area, BorderLayout.SOUTH); setBorder(empty_border); }
private void onBatch() { final boolean b = useBatchInputCheckbox.isSelected(); orientationComboBox.setEnabled(b); lengthField.setEnabled(b); dpiXField.setEnabled(b); dpiYField.setEnabled(b); startDepthField.setEnabled(b); depthIncField.setEnabled(b); applyToAllButton.setEnabled(b); applyToSelectedButton.setEnabled(b); if (!b) { orientationLabel.setEnabled(b); lengthLabel.setEnabled(b); dpiXLabel.setEnabled(b); dpiYLabel.setEnabled(b); startDepthLabel.setEnabled(b); depthIncLabel.setEnabled(b); } else { orientationLabel.setEnabled(orientationComboBox.getSelectedIndex() != 2); // [Blank] lengthLabel.setEnabled(!lengthField.getText().equals("")); dpiXLabel.setEnabled(!dpiXField.getText().equals("")); dpiYLabel.setEnabled(!dpiYField.getText().equals("")); startDepthLabel.setEnabled(!startDepthField.getText().equals("")); depthIncLabel.setEnabled(!depthIncField.getText().equals("")); } }
/** Get the current list of services */ public Vector getServiceList() { Vector list = null; if (service_box.isSelected()) { list = service_data; } return list; }
/** Reaction to checkbox changes. */ public void stateChanged(ChangeEvent e) { if (myMonitor.getMyNetwork().getContainer().getMyStatus().isStopped()) { enabled = cbEnabled.isSelected(); myMonitor.setEnabled(enabled); } else cbEnabled.setSelected(enabled); return; }
/** Load the settings of this panel */ private void loadSettings() { uploadPrioTextField.setText(settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD)); downloadPrioTextField.setText( settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD)); useOneConnectionForMessagesCheckBox.setSelected( settings.getBoolValue(SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES)); displayDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DISPLAY)); downloadDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DOWNLOAD)); messageBaseTextField.setText(settings.getValue(SettingsClass.MESSAGE_BASE)); alwaysDownloadBackloadCheckBox.setSelected( settings.getBoolValue(SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD)); minimumIntervalTextField.setText( settings.getValue(SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL)); concurrentUpdatesTextField.setText( settings.getValue(SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES)); // this setting is in MainFrame automaticBoardUpdateCheckBox.setSelected( MainFrame.getInstance().isAutomaticBoardUpdateEnabled()); refreshUpdateState(); storeSentMessagesCheckBox.setSelected( settings.getBoolValue(SettingsClass.STORAGE_STORE_SENT_MESSAGES)); silentlyRetryCheckBox.setSelected(settings.getBoolValue(SettingsClass.SILENTLY_RETRY_MESSAGES)); altEditCheckBox.setSelected(settings.getBoolValue(SettingsClass.ALTERNATE_EDITOR_ENABLED)); altEditTextField.setEnabled(altEditCheckBox.isSelected()); altEditTextField.setText(settings.getValue(SettingsClass.ALTERNATE_EDITOR_COMMAND)); }
private void setComponentsEnabled(boolean enabled) { list.setEnabled(enabled); process.setEnabled(enabled); remove.setEnabled(enabled); xres.setEnabled(enabled); yres.setEnabled(enabled); aspect.setEnabled(enabled); boolean b = aspect.isSelected() && enabled; colorLabel.setEnabled(b); colorBox.setEnabled(b); redLabel.setEnabled(b); red.setEnabled(b); redValue.setEnabled(b); greenLabel.setEnabled(b); green.setEnabled(b); greenValue.setEnabled(b); blueLabel.setEnabled(b); blue.setEnabled(b); blueValue.setEnabled(b); format.setEnabled(enabled); algorithm.setEnabled(enabled); prepend.setEnabled(enabled); append.setEnabled(enabled); output.setEnabled(enabled); }
public boolean validate() throws ConfigurationException { final String moduleName = getModuleName(); if (myCreateModuleCb.isSelected() || !myWizardContext.isCreatingNewProject()) { final String moduleFileDirectory = myModuleFileLocation.getText(); if (moduleFileDirectory.length() == 0) { throw new ConfigurationException("Enter module file location"); } if (moduleName.length() == 0) { throw new ConfigurationException("Enter a module name"); } if (!ProjectWizardUtil.createDirectoryIfNotExists( IdeBundle.message("directory.module.file"), moduleFileDirectory, myImlLocationChangedByUser)) { return false; } if (!ProjectWizardUtil.createDirectoryIfNotExists( IdeBundle.message("directory.module.content.root"), myModuleContentRoot.getText(), myContentRootChangedByUser)) { return false; } File moduleFile = new File(moduleFileDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION); if (moduleFile.exists()) { int answer = Messages.showYesNoDialog( IdeBundle.message( "prompt.overwrite.project.file", moduleFile.getAbsolutePath(), IdeBundle.message("project.new.wizard.module.identification")), IdeBundle.message("title.file.already.exists"), Messages.getQuestionIcon()); if (answer != 0) { return false; } } } if (!myWizardContext.isCreatingNewProject()) { final Module module; final ProjectStructureConfigurable fromConfigurable = ProjectStructureConfigurable.getInstance(myWizardContext.getProject()); if (fromConfigurable != null) { module = fromConfigurable.getModulesConfig().getModule(moduleName); } else { module = ModuleManager.getInstance(myWizardContext.getProject()).findModuleByName(moduleName); } if (module != null) { throw new ConfigurationException( "Module \'" + moduleName + "\' already exist in project. Please, specify another name."); } } return !myWizardContext.isCreatingNewProject() || super.validate(); }
/** * Apply properties * * @return Was successful */ protected boolean applyProperties() { if (!super.applyProperties()) { return false; } setLabelShown(labelShownCbx.isSelected()); setName(propertiesNameFld.getText().trim()); return true; }
private void checkBoundsFields() { if (specifyUPB.isSelected() || specifyLWB.isSelected()) { try { upb = Double.parseDouble(UPBLabel.getText()); lwb = Double.parseDouble(LWBLabel.getText()); if (specifyUPB.isSelected() && specifyLWB.isSelected()) { okListener.okEvent(upb > lwb); } else { okListener.okEvent(true); } } catch (Exception e) { okListener.okEvent(false); } } else { okListener.okEvent(true); } }
private void loadStates() { boolean b = enableDefaultEncryption.isSelected(); cboSavpOption.setEnabled(b); this.encryptionProtocolPreferences.setEnabled(b); enableSipZrtpAttribute.setEnabled( b && this.encryptionConfigurationTableModel.isEnabledLabel("ZRTP")); tabCiphers.setEnabled(b && this.encryptionConfigurationTableModel.isEnabledLabel("SDES")); }
private void updateComponentStatus() { /* * enable/disable component by first checkbox */ boolean enable = highlightSyntax.isSelected(); for (JComponent c : componentSet) { c.setEnabled(enable); } }
public Object getResult() { double rlwb; if (yesLWB.isSelected()) { if (specifyLWB.isSelected()) { if (excLWBButton.isSelected()) rlwb = lwb + Double.MIN_VALUE; else rlwb = lwb; } else rlwb = -Double.MAX_VALUE + Double.MIN_VALUE; } else rlwb = -Double.MAX_VALUE; double rupb; if (yesUPB.isSelected()) { if (specifyUPB.isSelected()) { if (excUPBButton.isSelected()) rupb = upb - Double.MIN_VALUE; else rupb = upb; } else rupb = Double.MAX_VALUE - Double.MIN_VALUE; } else rupb = Double.MAX_VALUE; return new Type.Continuous(rlwb, rupb, !unspecifiedCyclic.isSelected(), yesCyclic.isSelected()); }
public void updateStep() { super.updateStep(); if (!isCreateFromTemplateMode()) { if (myCreateModuleCb.isSelected()) { mySequence.setType(getSelectedBuilderId()); } else { mySequence.setType(null); } } }
public void updateDataModel() { if (!isCreateFromTemplateMode()) { mySequence.setType(myCreateModuleCb.isSelected() ? getSelectedBuilderId() : null); } super.updateDataModel(); if (!isCreateFromTemplateMode() && myCreateModuleCb.isSelected()) { final ModuleBuilder builder = (ModuleBuilder) myMode.getModuleBuilder(); assert builder != null; final String moduleName = getModuleName(); builder.setName(moduleName); builder.setModuleFilePath( FileUtil.toSystemIndependentName(myModuleFileLocation.getText()) + "/" + moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION); builder.setContentEntryPath(FileUtil.toSystemIndependentName(myModuleContentRoot.getText())); } }
/** * Constructor for FindDialog * * @param type * @param ta Description of the Parameter */ public FindDialog(JFrame parent, JTextComponent ta) { super(parent, "Find in Output", true); this.textarea = ta; textarea.requestFocus(); JPanel panel = new JPanel(); KappaLayout layout = new KappaLayout(); panel.setLayout(layout); panel.setBorder(new javax.swing.border.EmptyBorder(11, 11, 11, 11)); setContentPane(panel); JLabel find_label = new JLabel("Find:"); final JTextField to_find = new JTextField(20); JButton find_btn = new JButton("Find"); JButton find_next_btn = new JButton("Find Next"); JButton cancel_btn = new JButton("Close"); final JCheckBox wrap_cb = new JCheckBox("Wrap search"); wrap_cb.setSelected(true); panel.add(find_label, "0, 0, 1, 1, W, w, 3"); panel.add(to_find, "0, 1, 1, 1, 0, w, 3"); panel.add(wrap_cb, "0, 2, 1, 1, 0, w, 3"); JPanel btn_panel = new JPanel(new KappaLayout()); btn_panel.add(find_btn, "0, 0, 1, 1, 0, w, 3"); btn_panel.add(find_next_btn, "0, 1, 1, 1, 0, w, 3"); btn_panel.add(cancel_btn, "0, 2, 1, 1, 0, w, 3"); panel.add(btn_panel, "1, 0, 1, 3, 0, h, 5"); find_btn.addActionListener(new Finder(to_find, textarea, false, wrap_cb.isSelected())); find_next_btn.addActionListener(new Finder(to_find, textarea, true, wrap_cb.isSelected())); cancel_btn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { setVisible(false); dispose(); } }); pack(); to_find.requestFocus(); }
/** Update button enable/disable state according enableCheckBox. */ private void updateButtonsState() { sipProtocolCheckBox.setEnabled(enableCheckBox.isSelected()); jabberProtocolCheckBox.setEnabled(enableCheckBox.isSelected()); rtpProtocolCheckBox.setEnabled(enableCheckBox.isSelected()); ice4jProtocolCheckBox.setEnabled(enableCheckBox.isSelected()); fileCountField.setEnabled(enableCheckBox.isSelected()); fileSizeField.setEnabled(enableCheckBox.isSelected()); fileSizeLabel.setEnabled(enableCheckBox.isSelected()); fileCountLabel.setEnabled(enableCheckBox.isSelected()); }
/** Save the settings of this panel */ private void saveSettings() { settings.setValue( SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD, uploadPrioTextField.getText()); settings.setValue( SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD, downloadPrioTextField.getText()); settings.setValue( SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES, useOneConnectionForMessagesCheckBox.isSelected()); settings.setValue(SettingsClass.MAX_MESSAGE_DISPLAY, displayDaysTextField.getText()); settings.setValue(SettingsClass.MAX_MESSAGE_DOWNLOAD, downloadDaysTextField.getText()); settings.setValue( SettingsClass.MESSAGE_BASE, messageBaseTextField.getText().trim().toLowerCase()); settings.setValue( SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD, alwaysDownloadBackloadCheckBox.isSelected()); settings.setValue( SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES, concurrentUpdatesTextField.getText()); settings.setValue( SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL, minimumIntervalTextField.getText()); // settings.setValue(SettingsClass.BOARD_AUTOUPDATE_ENABLED, // automaticBoardUpdateCheckBox.isSelected()); // we change setting in MainFrame, this is auto-saved during frostSettings.save() MainFrame.getInstance() .setAutomaticBoardUpdateEnabled(automaticBoardUpdateCheckBox.isSelected()); settings.setValue( SettingsClass.STORAGE_STORE_SENT_MESSAGES, storeSentMessagesCheckBox.isSelected()); settings.setValue(SettingsClass.SILENTLY_RETRY_MESSAGES, silentlyRetryCheckBox.isSelected()); settings.setValue(SettingsClass.ALTERNATE_EDITOR_ENABLED, altEditCheckBox.isSelected()); settings.setValue(SettingsClass.ALTERNATE_EDITOR_COMMAND, altEditTextField.getText()); }
/** Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { Object source = e.getSource(); PacketLoggingService packetLogging = LoggingUtilsActivator.getPacketLoggingService(); if (source.equals(enableCheckBox)) { // turn it on/off in activator packetLogging.getConfiguration().setGlobalLoggingEnabled(enableCheckBox.isSelected()); updateButtonsState(); } else if (source.equals(sipProtocolCheckBox)) { packetLogging.getConfiguration().setSipLoggingEnabled(sipProtocolCheckBox.isSelected()); } else if (source.equals(jabberProtocolCheckBox)) { packetLogging.getConfiguration().setJabberLoggingEnabled(jabberProtocolCheckBox.isSelected()); } else if (source.equals(rtpProtocolCheckBox)) { packetLogging.getConfiguration().setRTPLoggingEnabled(rtpProtocolCheckBox.isSelected()); } else if (source.equals(ice4jProtocolCheckBox)) { packetLogging.getConfiguration().setIce4JLoggingEnabled(ice4jProtocolCheckBox.isSelected()); } else if (source.equals(archiveButton)) { // don't block the UI thread new Thread( new Runnable() { public void run() { collectLogs(); } }) .start(); } else if (source.equals(uploadLogsButton)) { // don't block the UI thread new Thread( new Runnable() { public void run() { uploadLogs(); } }) .start(); } }
/** * Returns the specific part of the action made on the entity. * * @return the specific part of the action made on the entity */ protected ActionEditEntitySpecific getSpecificAction() { String sprite = spriteField.getSelectedId(); if (!withSpriteField.isSelected()) { sprite = "_none"; } String behavior = "map"; if (messageField.isEnabled()) { behavior = "dialog#" + messageField.getText(); } else if (itemField.isEnabled()) { behavior = "item#" + itemField.getSelectedId(); } return new ActionEditEntitySpecific(entity, sprite, behavior); }
/** * Utility method to add components to dialog list * * @param comps list to add to * @param name name * @param cbx enable checkbox * @param comp the component */ private void addEditComponents( List comps, String name, final JCheckBox cbx, final JComponent comp) { cbx.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { GuiUtils.enableTree(comp, cbx.isSelected()); } }); GuiUtils.enableTree(comp, cbx.isSelected()); comps.add(GuiUtils.top(GuiUtils.inset(cbx, 5))); comps.add(GuiUtils.top(GuiUtils.inset(GuiUtils.rLabel(name), new Insets(8, 0, 0, 0)))); JComponent right = GuiUtils.inset(comp, new Insets(3, 5, 0, 0)); // comps.add(GuiUtils.leftCenter(GuiUtils.top(GuiUtils.inset(cbx, // new Insets(2, 0, 0, 0))), GuiUtils.topLeft(right))); comps.add(GuiUtils.topLeft(right)); }
private void savePreferences() { // grab the preferences so that they can be filled in from the // user's selections ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance(); // x resolution text box myPreferences.setStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME, xres.getText()); // y resolution text box myPreferences.setStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME, yres.getText()); // aspect ratio checkbox String aspectText; if (aspect.isSelected()) { aspectText = ThumbMakerPreferences.BOOLEAN_TRUE_STRING; } else aspectText = ThumbMakerPreferences.BOOLEAN_FALSE_STRING; myPreferences.setStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME, aspectText); // red slider myPreferences.setIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME, red.getValue()); // green slider myPreferences.setIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME, green.getValue()); // blue slider myPreferences.setIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME, blue.getValue()); // algorithm combo box myPreferences.setIntegerPref( ThumbMakerPreferences.RESIZE_ALG_PREF_NAME, algorithm.getSelectedIndex()); // format combo box myPreferences.setIntegerPref( ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME, format.getSelectedIndex()); // prepend field myPreferences.setStringPref( ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME, prepend.getText()); // append field myPreferences.setStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME, append.getText()); // output folder field myPreferences.setStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME, output.getText()); }
public void applyProperties() { visible = visibleCbx.isSelected(); float f = (float) (slider.getValue() / 100.0f); color = new Color3f(f, f, f); location = new Point3d( new Double(locationXFld.getText()).doubleValue(), new Double(locationYFld.getText()).doubleValue(), new Double(locationZFld.getText()).doubleValue()); direction = new Vector3f( new Float(directionXFld.getText()).floatValue(), new Float(directionYFld.getText()).floatValue(), new Float(directionZFld.getText()).floatValue()); updateLight(); }
/** * Creates the video advanced settings. * * @return video advanced settings panel. */ private static Component createVideoAdvancedSettings() { ResourceManagementService resources = NeomediaActivator.getResources(); final DeviceConfiguration deviceConfig = mediaService.getDeviceConfiguration(); TransparentPanel centerPanel = new TransparentPanel(new GridBagLayout()); centerPanel.setMaximumSize(new Dimension(WIDTH, 150)); JButton resetDefaultsButton = new JButton(resources.getI18NString("impl.media.configform.VIDEO_RESET")); JPanel resetButtonPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); resetButtonPanel.add(resetDefaultsButton); final JPanel centerAdvancedPanel = new TransparentPanel(new BorderLayout()); centerAdvancedPanel.add(centerPanel, BorderLayout.NORTH); centerAdvancedPanel.add(resetButtonPanel, BorderLayout.SOUTH); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.NORTHWEST; constraints.insets = new Insets(5, 5, 0, 0); constraints.gridx = 0; constraints.weightx = 0; constraints.weighty = 0; constraints.gridy = 0; centerPanel.add( new JLabel(resources.getI18NString("impl.media.configform.VIDEO_RESOLUTION")), constraints); constraints.gridy = 1; constraints.insets = new Insets(0, 0, 0, 0); final JCheckBox frameRateCheck = new SIPCommCheckBox(resources.getI18NString("impl.media.configform.VIDEO_FRAME_RATE")); centerPanel.add(frameRateCheck, constraints); constraints.gridy = 2; constraints.insets = new Insets(5, 5, 0, 0); centerPanel.add( new JLabel(resources.getI18NString("impl.media.configform.VIDEO_PACKETS_POLICY")), constraints); constraints.weightx = 1; constraints.gridx = 1; constraints.gridy = 0; constraints.insets = new Insets(5, 0, 0, 5); Object[] resolutionValues = new Object[DeviceConfiguration.SUPPORTED_RESOLUTIONS.length + 1]; System.arraycopy( DeviceConfiguration.SUPPORTED_RESOLUTIONS, 0, resolutionValues, 1, DeviceConfiguration.SUPPORTED_RESOLUTIONS.length); final JComboBox sizeCombo = new JComboBox(resolutionValues); sizeCombo.setRenderer(new ResolutionCellRenderer()); sizeCombo.setEditable(false); centerPanel.add(sizeCombo, constraints); // default value is 20 final JSpinner frameRate = new JSpinner(new SpinnerNumberModel(20, 5, 30, 1)); frameRate.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { deviceConfig.setFrameRate( ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue()); } }); constraints.gridy = 1; constraints.insets = new Insets(0, 0, 0, 5); centerPanel.add(frameRate, constraints); frameRateCheck.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (frameRateCheck.isSelected()) { deviceConfig.setFrameRate( ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue()); } else // unlimited framerate deviceConfig.setFrameRate(-1); frameRate.setEnabled(frameRateCheck.isSelected()); } }); final JSpinner videoMaxBandwidth = new JSpinner( new SpinnerNumberModel(deviceConfig.getVideoMaxBandwidth(), 1, Integer.MAX_VALUE, 1)); videoMaxBandwidth.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { deviceConfig.setVideoMaxBandwidth( ((SpinnerNumberModel) videoMaxBandwidth.getModel()).getNumber().intValue()); } }); constraints.gridx = 1; constraints.gridy = 2; constraints.insets = new Insets(0, 0, 5, 5); centerPanel.add(videoMaxBandwidth, constraints); resetDefaultsButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // reset to defaults sizeCombo.setSelectedIndex(0); frameRateCheck.setSelected(false); frameRate.setEnabled(false); frameRate.setValue(20); // unlimited framerate deviceConfig.setFrameRate(-1); videoMaxBandwidth.setValue(DeviceConfiguration.DEFAULT_VIDEO_MAX_BANDWIDTH); } }); // load selected value or auto Dimension videoSize = deviceConfig.getVideoSize(); if ((videoSize.getHeight() != DeviceConfiguration.DEFAULT_VIDEO_HEIGHT) && (videoSize.getWidth() != DeviceConfiguration.DEFAULT_VIDEO_WIDTH)) sizeCombo.setSelectedItem(deviceConfig.getVideoSize()); else sizeCombo.setSelectedIndex(0); sizeCombo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Dimension selectedVideoSize = (Dimension) sizeCombo.getSelectedItem(); if (selectedVideoSize == null) { // the auto value, default one selectedVideoSize = new Dimension( DeviceConfiguration.DEFAULT_VIDEO_WIDTH, DeviceConfiguration.DEFAULT_VIDEO_HEIGHT); } deviceConfig.setVideoSize(selectedVideoSize); } }); frameRateCheck.setSelected( deviceConfig.getFrameRate() != DeviceConfiguration.DEFAULT_VIDEO_FRAMERATE); frameRate.setEnabled(frameRateCheck.isSelected()); if (frameRate.isEnabled()) frameRate.setValue(deviceConfig.getFrameRate()); return centerAdvancedPanel; }
@Override public void actionPerformed(ActionEvent axnEve) { Object obj = axnEve.getSource(); if (obj == selectAllCB) { Boolean state; if (selectAllCB.isSelected()) { state = true; deleteBut.setVisible(true); if (Home.titlePan.getTitle().equals("Trash")) { restoreBut.setVisible(true); } } else { state = false; deleteBut.setVisible(false); if (Home.titlePan.getTitle().equals("Trash")) { restoreBut.setVisible(false); } } for (int i = 0; i < table.getRowCount(); i++) { table.setValueAt(state, i, 0); } } else if (obj == refreshBut || obj == backBut) { setContent(Home.titlePan.getTitle()); backBut.setVisible(false); } else if (obj == deleteBut) { ArrayList selectedMessages = getSelectedMessages(); if (selectedMessages.isEmpty()) { FootPan.setMessage(FootPan.NO_SELECTION_MESSAGE); } else { int option = JOptionPane.showConfirmDialog( Home.home.homeFrame, "Are You Sure?", "DELETE", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (option == 0) { Database.deleteMessages(selectedMessages, Home.titlePan.getTitle()); setContent(Home.titlePan.getTitle()); } } } else if (obj == restoreBut) { ArrayList selectedMessages = getSelectedMessages(); if (selectedMessages.isEmpty()) { FootPan.setMessage(FootPan.NO_SELECTION_MESSAGE); } else { int option = JOptionPane.showConfirmDialog( Home.home.homeFrame, "Are You Sure?", "RESTORE", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (option == 0) { Database.restoreMessages(selectedMessages); setContent(Home.titlePan.getTitle()); } } } }