public MyJObject(int i) { CourseCheckBox = new JCheckBox(DataTransfer.Courses.elementAt(i)); CourseCheckBox.setForeground(Color.WHITE); CourseCheckBox.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13)); CourseCheckBox.setHorizontalAlignment(SwingConstants.LEFT); CourseCheckBox.setOpaque(false); CourseCheckBox.setSelected(true); TotalMarks = new JLabel( Float.toString( Float.valueOf( TwoDecimal.format(Float.parseFloat(DataTransfer.Total.elementAt(i))))), SwingConstants.CENTER); TotalMarks.setForeground(Color.WHITE); TotalMarks.setFont(new Font("SERRIF", Font.BOLD + Font.ITALIC, 13)); GradePoint = new JLabel(DataTransfer.GradePoint.elementAt(i), SwingConstants.LEFT); GradePoint.setForeground(Color.WHITE); GradePoint.setFont(new Font("SERRIF", Font.ITALIC, 13)); LetterGrade = new JLabel(DataTransfer.LetterGrade.elementAt(i), SwingConstants.LEFT); LetterGrade.setForeground(Color.WHITE); LetterGrade.setFont(new Font("SERRIF", Font.PLAIN, 13)); CreditLabel = new JLabel(Credit.elementAt(i), SwingConstants.LEFT); CreditLabel.setForeground(Color.WHITE); CreditLabel.setFont(new Font("SERRIF", Font.PLAIN, 13)); ExamTypeLabel = new JLabel(DataTransfer.ExamType.elementAt(i), SwingConstants.LEFT); ExamTypeLabel.setForeground(Color.WHITE); ExamTypeLabel.setFont(new Font("SERRIF", Font.PLAIN, 12)); }
/* * Checks if the preferences have changed from the cached preferences. */ private boolean prefsChanged() { return (prefs.getResolution() != resolution.getSelectedItem()) || (prefs.getFullscreen() != fullscreen.isSelected()) || (prefs.getBitrate() != bitrate.getValue()) || (prefs.getUseOpenGlRenderer() != openGlRenderer.isSelected()) || (prefs.getLocalAudio() != localAudio.isSelected()); }
public void setEditable(boolean isEditable) { isEditable_ = isEditable; if (inputType_.equals("ALPHA") || inputType_.equals("KANJI") || inputType_.equals("NUMERIC")) { ((JTextField) component).setEditable(isEditable_); ((JTextField) component).setFocusable(isEditable_); } if (inputType_.equals("DATE")) { ((XFDateField) component).setEditable(isEditable_); ((XFDateField) component).setFocusable(isEditable_); int fieldWidth = XFUtility.getWidthOfDateValue(dialog_.getSession().getDateFormat(), 14); if (isEditable_) { this.setBounds( this.getBounds().x, this.getBounds().y, 150 + fieldWidth, XFUtility.FIELD_UNIT_HEIGHT); } else { this.setBounds( this.getBounds().x, this.getBounds().y, 124 + fieldWidth, XFUtility.FIELD_UNIT_HEIGHT); } } if (inputType_.equals("LISTBOX")) { ((JComboBox) component).setEditable(isEditable_); ((JComboBox) component).setFocusable(isEditable_); } if (inputType_.equals("CHECKBOX")) { ((JCheckBox) component).setEnabled(isEditable_); ((JCheckBox) component).setFocusable(isEditable_); } }
/** Loads the default settings from Preferences to set up the dialog. */ public void legacyLoadDefaults() { String defaultsString = Preferences.getDialogDefaults(getDialogName()); if ((defaultsString != null) && (newImage != null)) { try { StringTokenizer st = new StringTokenizer(defaultsString, ","); textSearchWindowSide.setText("" + MipavUtil.getInt(st)); textSimilarityWindowSide.setText("" + MipavUtil.getInt(st)); textNoiseStandardDeviation.setText("" + MipavUtil.getFloat(st)); textDegree.setText("" + MipavUtil.getFloat(st)); doRician = MipavUtil.getBoolean(st); doRicianCheckBox.setSelected(doRician); textDegree.setEnabled(doRician); labelDegree.setEnabled(doRician); image25DCheckBox.setSelected(MipavUtil.getBoolean(st)); if (MipavUtil.getBoolean(st)) { newImage.setSelected(true); } else { replaceImage.setSelected(true); } } catch (Exception ex) { // since there was a problem parsing the defaults string, start over with the original // defaults Preferences.debug("Resetting defaults for dialog: " + getDialogName()); Preferences.removeProperty(getDialogName()); } } }
// counts up the score of the user. @SuppressWarnings("unchecked") public int scoreCounter() { if (b1.isSelected()) { score1++; } else if (c1.isSelected()) { score1++; } else if (d1.isSelected()) { score1++; } else if (e1.isSelected()) { score1++; } else if (f1.isSelected()) { score1++; } else if (g1.isSelected()) { score1++; } else if (h1.isSelected()) { score1++; } else if (i1.isSelected()) { score1++; } else if (j1.isSelected()) { score1++; } else if (k1.isSelected()) { score1++; } System.out.println(score1); return score1; }
@Override public void apply(@NotNull HttpConfigurable settings) { if (!isValid()) { return; } if (isModified(settings)) { settings.AUTHENTICATION_CANCELLED = false; } settings.USE_PROXY_PAC = myAutoDetectProxyRb.isSelected(); settings.USE_PAC_URL = myPacUrlCheckBox.isSelected(); settings.PAC_URL = getText(myPacUrlTextField); settings.USE_HTTP_PROXY = myUseHTTPProxyRb.isSelected(); settings.PROXY_TYPE_IS_SOCKS = mySocks.isSelected(); settings.PROXY_AUTHENTICATION = myProxyAuthCheckBox.isSelected(); settings.KEEP_PROXY_PASSWORD = myRememberProxyPasswordCheckBox.isSelected(); settings.setProxyLogin(getText(myProxyLoginTextField)); settings.setPlainProxyPassword(new String(myProxyPasswordTextField.getPassword())); settings.PROXY_EXCEPTIONS = StringUtil.nullize(myProxyExceptions.getText(), true); settings.PROXY_PORT = myProxyPortTextField.getNumber(); settings.PROXY_HOST = getText(myProxyHostTextField); }
void update(String group) { myTitleLabel.setText( "<html><body><h2 style=\"text-align:left;\">" + group + "</h2></body></html>"); myContentPanel.removeAll(); List<IdSet> idSets = PluginGroups.getInstance().getSets(group); for (final IdSet set : idSets) { final JCheckBox checkBox = new JCheckBox(set.getTitle(), PluginGroups.getInstance().isIdSetAllEnabled(set)); checkBox.setModel( new JToggleButton.ToggleButtonModel() { @Override public boolean isSelected() { return PluginGroups.getInstance().isIdSetAllEnabled(set); } }); checkBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginGroups.getInstance().setIdSetEnabled(set, !checkBox.isSelected()); CustomizePluginsStepPanel.this.repaint(); } }); myContentPanel.add(checkBox); } }
/** * Message sent from a customer gui to enable that customer's "I'm hungry" checkbox. * * @param c reference to the customer */ public void setCustomerEnabled(Customer c) { Customer cust = currentCustomer; if (c.equals(cust)) { customerStateCheckBox.setEnabled(true); customerStateCheckBox.setSelected(false); } }
public void actionPerformed(ActionEvent ae) { String cname = nameF.getText().trim(); int state = conditions[stateC.getSelectedIndex()]; try { if (isSpecialCase(cname)) { handleSpecialCase(cname, state); } else { JComponent comp = (JComponent) Class.forName(cname).newInstance(); ComponentUI cui = UIManager.getUI(comp); cui.installUI(comp); results.setText("Map entries for " + cname + ":\n\n"); if (inputB.isSelected()) { loadInputMap(comp.getInputMap(state), ""); results.append("\n"); } if (actionB.isSelected()) { loadActionMap(comp.getActionMap(), ""); results.append("\n"); } if (bindingB.isSelected()) { loadBindingMap(comp, state); } } } catch (ClassCastException cce) { results.setText(cname + " is not a subclass of JComponent."); } catch (ClassNotFoundException cnfe) { results.setText(cname + " was not found."); } catch (InstantiationException ie) { results.setText(cname + " could not be instantiated."); } catch (Exception e) { results.setText("Exception found:\n" + e); e.printStackTrace(); } }
/*-------------------------------------------------------------------------*/ public FoeTypeSelection(int dirtyFlag) { this.dirtyFlag = dirtyFlag; List<String> foeTypesList = new ArrayList<String>(Database.getInstance().getFoeTypes().keySet()); Collections.sort(foeTypesList); int max = foeTypesList.size(); checkBoxes = new HashMap<String, JCheckBox>(); JPanel panel = new JPanel(new GridLayout(max / 2 + 2, 2, 3, 3)); selectAll = new JButton("Select All"); selectAll.addActionListener(this); selectNone = new JButton("Select None"); selectNone.addActionListener(this); panel.add(selectAll); panel.add(selectNone); for (String s : foeTypesList) { JCheckBox cb = new JCheckBox(s); checkBoxes.put(s, cb); cb.addActionListener(this); panel.add(cb); } JScrollPane scroller = new JScrollPane(panel); this.add(scroller); }
public void updateLastCustomer() { if (currentCustomer != null) { customerStateCheckBox.setSelected(currentCustomer.getGui().isHungry()); customerStateCheckBox.setEnabled(!currentCustomer.getGui().isHungry()); customerInformationPanel.validate(); } }
private JPanel createCompPanel() { filesets = new Vector(); int count = installer.getIntegerProperty("comp.count"); JPanel panel = new JPanel(new GridLayout(count, 1)); String osClass = OperatingSystem.getOperatingSystem().getClass().getName(); osClass = osClass.substring(osClass.indexOf('$') + 1); for (int i = 0; i < count; i++) { String os = installer.getProperty("comp." + i + ".os"); if (os != null && !osClass.equals(os)) continue; JCheckBox checkBox = new JCheckBox( installer.getProperty("comp." + i + ".name") + " (" + installer.getProperty("comp." + i + ".disk-size") + "Mb)"); checkBox.getModel().setSelected(true); checkBox.addActionListener(this); checkBox.setRequestFocusEnabled(false); filesets.addElement(new Integer(i)); panel.add(checkBox); } Dimension dim = panel.getPreferredSize(); dim.width = Integer.MAX_VALUE; panel.setMaximumSize(dim); return panel; }
/** * set new frame for this view We start listening for frame action/status and click events * instandly. If an event occurs, we use it to synchronize our controls with states of a (maybe) * new document view of this frame. * * @param xFrame the reference to the frame, which provides the possibility to get the required * status information * <p>Attention: We don't accept new frames here. We get one after startup and work with it. * That's it! */ public void setFrame(com.sun.star.frame.XFrame xFrame) { if (xFrame == null) return; // be listener for click events // They will toogle the UI controls. ClickListener aMenuBarHandler = new ClickListener(FEATUREURL_MENUBAR, FEATUREPROP_MENUBAR, xFrame); ClickListener aToolBarHandler = new ClickListener(FEATUREURL_TOOLBAR, FEATUREPROP_TOOLBAR, xFrame); ClickListener aObjectBarHandler = new ClickListener(FEATUREURL_OBJECTBAR, FEATUREPROP_OBJECTBAR, xFrame); m_cbMenuBar.addActionListener(aMenuBarHandler); m_cbToolBar.addActionListener(aToolBarHandler); m_cbObjectBar.addActionListener(aObjectBarHandler); // be frame action listener // The callback will update listener connections // for status updates automaticly! m_aMenuBarListener = new StatusListener(m_cbMenuBar, MENUBAR_ON, MENUBAR_OFF, xFrame, FEATUREURL_MENUBAR); m_aToolBarListener = new StatusListener(m_cbToolBar, TOOLBAR_ON, TOOLBAR_OFF, xFrame, FEATUREURL_TOOLBAR); m_aObjectBarListener = new StatusListener( m_cbObjectBar, OBJECTBAR_ON, OBJECTBAR_OFF, xFrame, FEATUREURL_OBJECTBAR); m_aMenuBarListener.startListening(); m_aToolBarListener.startListening(); m_aObjectBarListener.startListening(); }
public void setOptions(BeautiOptions options) { this.options = options; chainLengthField.setValue(options.chainLength); echoEveryField.setValue(options.echoEvery); logEveryField.setValue(options.logEvery); if (options.fileNameStem != null) { fileNameStemField.setText(options.fileNameStem); } else { fileNameStemField.setText(DEFAULT_FILE_NAME_STEM); fileNameStemField.setEnabled(false); } operatorAnalaysisCheck.setSelected(options.operatorAnalysis); updateOtherFileNames(options); if (options.contains(Microsatellite.INSTANCE)) { samplePriorCheckBox.setSelected(false); samplePriorCheckBox.setVisible(false); } else { samplePriorCheckBox.setVisible(true); samplePriorCheckBox.setSelected(options.samplePriorOnly); } optionsPanel.validate(); optionsPanel.repaint(); }
public CheckBoxes() { cb1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { trace("1", cb1); } }); cb2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { trace("2", cb2); } }); cb3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { trace("3", cb3); } }); setLayout(new FlowLayout()); add(new JScrollPane(t)); add(cb1); add(cb2); add(cb3); }
HDTextureConfig() { comboListeners = new AnimationComboListener[4]; comboListeners[0] = new AnimationComboListener(waterCombo, "Water"); comboListeners[1] = new AnimationComboListener(lavaCombo, "Lava"); comboListeners[2] = new AnimationComboListener(fireCombo, "Fire"); comboListeners[3] = new AnimationComboListener(portalCombo, "Portal"); waterCombo.addItemListener(comboListeners[0]); lavaCombo.addItemListener(comboListeners[1]); fireCombo.addItemListener(comboListeners[2]); portalCombo.addItemListener(comboListeners[3]); otherCombo.addItem("Not Animated"); otherCombo.addItem("Custom Animated"); otherCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { switch (otherCombo.getSelectedIndex()) { case 0: MCPatcherUtils.set(MCPatcherUtils.HD_TEXTURES, "customOther", false); break; case 1: MCPatcherUtils.set(MCPatcherUtils.HD_TEXTURES, "customOther", true); break; default: break; } } } }); textureCacheCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { MCPatcherUtils.set( MCPatcherUtils.HD_TEXTURES, "useTextureCache", textureCacheCheckBox.isSelected()); } }); shrinkGLMemoryCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { MCPatcherUtils.set( MCPatcherUtils.HD_TEXTURES, "reclaimGLMemory", shrinkGLMemoryCheckBox.isSelected()); } }); autoRefreshTexturesCheckBox.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { MCPatcherUtils.set( MCPatcherUtils.HD_TEXTURES, "autoRefreshTextures", autoRefreshTexturesCheckBox.isSelected()); } }); }
@Override public void reset(@NotNull HttpConfigurable settings) { myNoProxyRb.setSelected(true); // default myAutoDetectProxyRb.setSelected(settings.USE_PROXY_PAC); myPacUrlCheckBox.setSelected(settings.USE_PAC_URL); myPacUrlTextField.setText(settings.PAC_URL); myUseHTTPProxyRb.setSelected(settings.USE_HTTP_PROXY); myProxyAuthCheckBox.setSelected(settings.PROXY_AUTHENTICATION); enableProxy(settings.USE_HTTP_PROXY); myProxyLoginTextField.setText(settings.getProxyLogin()); myProxyPasswordTextField.setText(settings.getPlainProxyPassword()); myProxyPortTextField.setNumber(settings.PROXY_PORT); myProxyHostTextField.setText(settings.PROXY_HOST); myProxyExceptions.setText(StringUtil.notNullize(settings.PROXY_EXCEPTIONS)); myRememberProxyPasswordCheckBox.setSelected(settings.KEEP_PROXY_PASSWORD); mySocks.setSelected(settings.PROXY_TYPE_IS_SOCKS); myHTTP.setSelected(!settings.PROXY_TYPE_IS_SOCKS); boolean showError = !StringUtil.isEmptyOrSpaces(settings.LAST_ERROR); myErrorLabel.setVisible(showError); myErrorLabel.setText(showError ? errorText(settings.LAST_ERROR) : null); final String oldStyleText = CommonProxy.getMessageFromProps(CommonProxy.getOldStyleProperties()); myOtherWarning.setVisible(oldStyleText != null); if (oldStyleText != null) { myOtherWarning.setText(oldStyleText); myOtherWarning.setIcon(Messages.getWarningIcon()); } }
@Override public void load() { for (AnimationComboListener listener : comboListeners) { listener.load(); } otherCombo.setSelectedIndex( MCPatcherUtils.getBoolean(MCPatcherUtils.HD_TEXTURES, "customOther", true) ? 1 : 0); boolean is64bit = false; try { String datamodel = System.getProperty("sun.arch.data.model"); // sun-specific, but gets the arch of the jvm String arch = System.getProperty( "os.arch"); // generic, but gets the arch of the os, not the jvm (may be a 32-bit jvm // on a 64-bit os) if (datamodel != null) { is64bit = (Integer.parseInt(datamodel) >= 64); } else if (arch != null) { is64bit = arch.contains("64"); } else { is64bit = false; } } catch (Throwable e) { } textureCacheCheckBox.setSelected( MCPatcherUtils.getBoolean(MCPatcherUtils.HD_TEXTURES, "useTextureCache", is64bit)); shrinkGLMemoryCheckBox.setSelected( MCPatcherUtils.getBoolean(MCPatcherUtils.HD_TEXTURES, "reclaimGLMemory", false)); autoRefreshTexturesCheckBox.setSelected( MCPatcherUtils.getBoolean(MCPatcherUtils.HD_TEXTURES, "autoRefreshTextures", false)); }
/* * 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
@Override public JComponent createForm() { JComponent component = super.createForm(); annotationComboBox.setRenderer( new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value != null) { Annotation annotation = (Annotation) value; this.setText(annotation.getBrief()); } else { this.setText("-- select annotation --"); } return this; } }); component.setLayout(new FormLayout("right:p, 4dlu, left:p", "p, 4dlu, p, 4dlu, p, 4dlu, p")); CellConstraints cc = new CellConstraints(); component.add(getLabel("annotationLabel"), cc.xy(1, 1)); component.add(annotationComboBox, cc.xy(3, 1)); component.add(getLabel("patternLabel"), cc.xy(1, 3)); component.add(patternField, cc.xy(3, 3)); component.add(getLabel("ciLabel"), cc.xy(1, 5)); component.add(caseInsensitive, cc.xy(3, 5)); component.add(getLabel("remove"), cc.xy(1, 7)); component.add(removeMatched, cc.xy(3, 7)); patternField.setEnabled(false); caseInsensitive.setSelected(true); caseInsensitive.setEnabled(false); // action listener will fill out a suggested pattern for selected annotation types annotationComboBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object obj = annotationComboBox.getSelectedItem(); if (obj == null) { patternField.setEnabled(false); caseInsensitive.setEnabled(false); setEnabled(false); } else { patternField.setEnabled(true); caseInsensitive.setEnabled(true); patternField.setText(getDefault(obj.getClass())); patternField.setCaretPosition(0); setEnabled(true); } } }); return component; }
@Override public JComponent createCustomComponent(Presentation presentation) { // this component cannot be stored right here because of action system architecture: // one action can be shown on multiple toolbars simultaneously JCheckBox checkBox = new JCheckBox(); checkBox.setOpaque(false); checkBox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JCheckBox checkBox = (JCheckBox) e.getSource(); ActionToolbar actionToolbar = UIUtil.getParentOfType(ActionToolbar.class, checkBox); DataContext dataContext = actionToolbar != null ? actionToolbar.getToolbarDataContext() : DataManager.getInstance().getDataContext(checkBox); CheckboxAction.this.actionPerformed( new AnActionEvent( null, dataContext, ActionPlaces.UNKNOWN, CheckboxAction.this.getTemplatePresentation(), ActionManager.getInstance(), 0)); } }); return checkBox; }
public void buildTrackAndStart() { int[] trackList = null; sequence.deleteTrack(track); track = sequence.createTrack(); for (int i = 0; i < 16; i++) { trackList = new int[16]; int key = instruments[i]; for (int j = 0; j < 16; j++) { JCheckBox jc = (JCheckBox) checkboxList.get(j + (16 * i)); if (jc.isSelected()) { trackList[j] = key; } else { trackList[j] = 0; } } // close inner loop makeTracks(trackList); track.add(makeEvent(176, 1, 127, 0, 16)); } // close outer track.add(makeEvent(192, 9, 1, 0, 15)); try { sequencer.setSequence(sequence); sequencer.setLoopCount(sequencer.LOOP_CONTINUOUSLY); sequencer.start(); sequencer.setTempoInBPM(120); } catch (Exception e) { e.printStackTrace(); } } // close buildTrackAndStart method
public boolean isDoNotAskMe() { if (myDoNotAskMeCheckBox.isEnabled()) { return myDoNotAskMeCheckBox.isSelected(); } else { return !EditorSettingsExternalizable.getInstance().getOptions().SHOW_REFORMAT_DIALOG; } }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == imageView) { selectedView = imageView.getSelectedIndex(); owner.viewUpdated(); } else if (e.getSource() == showCorners) { bShowCorners = showCorners.isSelected(); owner.viewUpdated(); } else if (e.getSource() == showLines) { bShowLines = showLines.isSelected(); owner.viewUpdated(); } else if (e.getSource() == showContour) { bShowContour = showContour.isSelected(); owner.viewUpdated(); } else if (e.getSource() == refineChoice) { refineType = PolygonRefineType.values()[refineChoice.getSelectedIndex()]; updateRefineSettings(); owner.configUpdate(); } else if (e.getSource() == setConvex) { config.convex = setConvex.isSelected(); owner.configUpdate(); } else if (e.getSource() == setBorder) { config.convex = setBorder.isSelected(); owner.configUpdate(); } }
@Override public void reset() { VcsContentAnnotationSettings settings = VcsContentAnnotationSettings.getInstance(myProject); myHighlightRecentlyChanged.setSelected(settings.isShow()); myHighlightInterval.setValue(settings.getLimitDays()); myHighlightInterval.setEnabled(myHighlightRecentlyChanged.isSelected()); }
private MainPanel() { super(new GridLayout(3, 1, 5, 5)); final JTree tree = new JTree(); final JCheckBox c = new JCheckBox("CheckBox", true); c.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tree.setEnabled(c.isSelected()); } }); c.setFocusPainted(false); JScrollPane l1 = new JScrollPane(tree); l1.setBorder(new ComponentTitledBorder(c, l1, BorderFactory.createEtchedBorder())); JLabel icon = new JLabel(new ImageIcon(getClass().getResource("16x16.png"))); JLabel l2 = new JLabel("<html>aaaaaaaaaaaaaaaa<br>bbbbbbbbbbbbbbbbb"); l2.setBorder(new ComponentTitledBorder(icon, l2, BorderFactory.createEtchedBorder())); JButton b = new JButton("Button"); b.setFocusPainted(false); JLabel l3 = new JLabel("ccccccccccccccc"); l3.setBorder(new ComponentTitledBorder(b, l3, BorderFactory.createEtchedBorder())); add(l1); add(l2); add(l3); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setPreferredSize(new Dimension(320, 240)); }
/** * Creates a checkbox and sets it's value. * * @param strText either 'yes' or 'no' if yes then set the checkbox selected. */ protected JCheckBox createChkBox(String strText, JPanel pnlDisplay) { JCheckBox chkField = new JCheckBox(); boolean bSelected = (strText.equalsIgnoreCase("yes")) ? true : false; chkField.setSelected(bSelected); pnlDisplay.add(chkField); return chkField; }
protected void performRefactoring( Project project, PsiDirectory directory, PsiPackage aPackage, boolean searchInComments, boolean searchForTextOccurences) { final VirtualFile sourceRoot = ProjectRootManager.getInstance(project) .getFileIndex() .getSourceRootForFile(directory.getVirtualFile()); if (sourceRoot == null) { Messages.showErrorDialog( project, RefactoringBundle.message("destination.directory.does.not.correspond.to.any.package"), RefactoringBundle.message("cannot.move")); return; } final JavaRefactoringFactory factory = JavaRefactoringFactory.getInstance(project); final MoveDestination destination = myPreserveSourceRoot.isSelected() && myPreserveSourceRoot.isVisible() ? factory.createSourceFolderPreservingMoveDestination(aPackage.getQualifiedName()) : factory.createSourceRootMoveDestination(aPackage.getQualifiedName(), sourceRoot); MoveClassesOrPackagesProcessor processor = new MoveClassesOrPackagesProcessor( myDirectory.getProject(), myElementsToMove, destination, searchInComments, searchForTextOccurences, myMoveCallback); if (processor.verifyValidPackageName()) { processor.run(); } }
/** * The ActionListener implementation * * @param event the event. */ public void actionPerformed(ActionEvent event) { String searchText = textField.getText().trim(); if (searchText.equals("") && !saveAs.isSelected() && (fileLength > 10000000)) { textPane.setText("Blank search text is not allowed for large IdTables."); } else { File outputFile = null; if (saveAs.isSelected()) { outputFile = chooser.getSelectedFile(); if (outputFile != null) { String name = outputFile.getName(); int k = name.lastIndexOf("."); if (k != -1) name = name.substring(0, k); name += ".txt"; File parent = outputFile.getAbsoluteFile().getParentFile(); outputFile = new File(parent, name); chooser.setSelectedFile(outputFile); } if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) System.exit(0); outputFile = chooser.getSelectedFile(); } textPane.setText(""); Searcher searcher = new Searcher(searchText, event.getSource().equals(searchPHI), outputFile); searcher.start(); } }
@Override public void actionPerformed(ActionEvent AE) { if (AE.getSource() == CheckAll) { boolean Selection = CheckAll.isSelected(); if (Selection) CheckAll.setText("Uncheck all"); else CheckAll.setText("Check all"); for (int i = 0; i < NumberOfCourses; i++) My[i].CourseCheckBox.setSelected(Selection); } if (AE.getSource() == DocButton) if (TempControll.ConnectionManagerObject.createConnection()) { new File(System.getProperty("user.home") + "/TermResultCalculator/StudentDocs/").mkdirs(); if (gatherDataForDocument()) { if (TempControll.StudentPdfObject.createPDF( this.Roll, this.Session, this.Selected, this.Taken, this.Completed, this.GPA)) JOptionPane.showMessageDialog( RPS, "Report created successfully at " + System.getProperty("user.home") + "/TermResultCalculator/StudentDocs/", "Success", JOptionPane.INFORMATION_MESSAGE); else JOptionPane.showMessageDialog( RPS, "Error while creating report.", "Error", JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog( RPS, "At least one course has to be selected.", "Error : No Selection", JOptionPane.ERROR_MESSAGE); } }