List of usage examples for java.awt Label Label
public Label(String text) throws HeadlessException
From source file:MessageViewer.java
protected Component getBodyComponent() { //------------ // now get a content viewer for the main type... //------------ try {// w w w . j ava 2 s . c o m DataHandler dh = displayed.getDataHandler(); CommandInfo ci = dh.getCommand("view"); if (ci == null) { throw new MessagingException("view command failed on: " + displayed.getContentType()); } Object bean = dh.getBean(ci); if (bean instanceof Component) { return (Component) bean; } else { throw new MessagingException("bean is not a component " + bean.getClass().toString()); } } catch (MessagingException me) { return new Label(me.toString()); } }
From source file:Presentation.MainWindow.java
private void addSlider() { JSlider sliderTemp = new JSlider(12, 26, 26); sliderTemp.setLabelTable(sliderTemp.createStandardLabels(14)); sliderTemp.setMinorTickSpacing(1);//from w ww . j ava 2s. c om sliderTemp.setPaintLabels(true); sliderTemp.setPaintTicks(true); this.tSlider = sliderTemp; Label labelConsigne = new Label("Temprature de consigne : " + tSlider.getValue() + " C"); //Label labelOutdoorTemp = new Label(Singleton.getInstance().getAcquisition().getOutdoorTemp()); this.tLabel = labelConsigne; mPanel.add(labelConsigne); mPanel.add(sliderTemp); }
From source file:Sampler.java
private void createUI() { setFont(new Font("Serif", Font.PLAIN, 12)); setLayout(new BorderLayout()); // Set our location to the left of the image frame. setSize(200, 350);/*from www .j av a 2 s.c o m*/ Point pt = mImageFrame.getLocation(); setLocation(pt.x - getSize().width, pt.y); final Checkbox accumulateCheckbox = new Checkbox("Accumulate", false); final Label statusLabel = new Label(""); // Make a sorted list of the operators. Enumeration e = mOps.keys(); Vector names = new Vector(); while (e.hasMoreElements()) names.addElement(e.nextElement()); Collections.sort(names); final java.awt.List list = new java.awt.List(); for (int i = 0; i < names.size(); i++) list.add((String) names.elementAt(i)); add(list, BorderLayout.CENTER); // When an item is selected, do the corresponding transformation. list.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { if (ie.getStateChange() != ItemEvent.SELECTED) return; String key = list.getSelectedItem(); BufferedImageOp op = (BufferedImageOp) mOps.get(key); BufferedImage source = mSplitImageComponent.getSecondImage(); boolean accumulate = accumulateCheckbox.getState(); if (source == null || accumulate == false) source = mSplitImageComponent.getImage(); String previous = mImageFrame.getTitle() + " + "; if (accumulate == false) previous = ""; mImageFrame.setTitle(previous + key); statusLabel.setText("Performing " + key + "..."); list.setEnabled(false); accumulateCheckbox.setEnabled(false); BufferedImage destination = op.filter(source, null); mSplitImageComponent.setSecondImage(destination); mSplitImageComponent.setSize(mSplitImageComponent.getPreferredSize()); mImageFrame.setSize(mImageFrame.getPreferredSize()); list.setEnabled(true); accumulateCheckbox.setEnabled(true); statusLabel.setText("Performing " + key + "...done."); } }); Button loadButton = new Button("Load..."); loadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { FileDialog fd = new FileDialog(Sampler.this); fd.show(); if (fd.getFile() == null) return; String path = fd.getDirectory() + fd.getFile(); mSplitImageComponent.setImage(path); mSplitImageComponent.setSecondImage(null); // Utilities.sizeContainerToComponent(mImageFrame, // mSplitImageComponent); mImageFrame.validate(); mImageFrame.repaint(); } }); Panel bottom = new Panel(new GridLayout(2, 1)); Panel topBottom = new Panel(); topBottom.add(accumulateCheckbox); topBottom.add(loadButton); bottom.add(topBottom); bottom.add(statusLabel); add(bottom, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { mImageFrame.dispose(); dispose(); System.exit(0); } }); }
From source file:AlphaTest.java
/** * Helper method to add a TextField to the UI *//* ww w .j a va 2s . c o m*/ protected void addField(final String szText, final int nIndex) { Label label = new Label(szText); TextField textField = new TextField(4); m_EditFieldVector.add(nIndex, (Object) textField); add(label); add(textField); }
From source file:CustomAlphaTest.java
protected void addField(final String szText, final int nIndex) { Label label = new Label(szText); TextField textField = new TextField(4); m_EditFieldVector.add(nIndex, (Object) textField); add(label);/*from w w w . j av a 2s . c o m*/ add(textField); }
From source file:gdsc.utils.HSB_Picker.java
private void createFrame() { setLayout(mainGrid);/*from w w w. j av a 2 s . c o m*/ createSliderPanel(sampleSlider = new Scrollbar(Scrollbar.HORIZONTAL, 2, 1, 0, 15), "Sample radius", sampleLabel = new Label("0"), 1); createLabelPanel(nLabel = new Label(), "Pixels", "0"); createLabelPanel(statsLabel[0] = new Label(), "Hue", "0"); createLabelPanel(statsLabel[1] = new Label(), "Saturation", "0"); createLabelPanel(statsLabel[2] = new Label(), "Brightness", "0"); // Add the buttons clearButton = new Button("Reset"); clearButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clear(); } }); add(clearButton, 0, 3); row++; createSliderPanel( scaleSlider = new Scrollbar(Scrollbar.HORIZONTAL, (int) (2 * SCALE), 1, 1, (int) (4 * SCALE)), "Filter scale", scaleLabel = new Label("0"), SCALE); // Add the buttons filterButton = new Button("HSB Filter"); filterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { runFilter(); } }); okButton = new Button("Close"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { close(); } }); helpButton = new Button("Help"); helpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String macro = "run('URL...', 'url=" + gdsc.help.URL.UTILITY + "');"; new MacroRunner(macro); } }); JPanel buttonPanel = new JPanel(); FlowLayout l = new FlowLayout(); l.setVgap(0); buttonPanel.setLayout(l); buttonPanel.add(filterButton, BorderLayout.CENTER); buttonPanel.add(okButton, BorderLayout.CENTER); buttonPanel.add(helpButton, BorderLayout.CENTER); add(buttonPanel, 0, 3); row++; updateDisplayedStatistics(); }
From source file:eu.apenet.dpt.standalone.gui.ead2edm.EdmOptionsPanel.java
private void createOptionPanel() { labels = dataPreparationToolGUI.getLabels(); JPanel creativeCommonsPanel = new CreativeCommonsPanel(); JPanel europeanaRightsPanel = new EuropeanaRightsPanel(); JPanel emptyPanel = new JPanel(); JPanel formPanel = new JPanel(new GridLayout(14, 1)); JPanel extraLicenseCardLayoutPanel = new JPanel(new CardLayout()); extraLicenseCardLayoutPanel.add(creativeCommonsPanel, CREATIVE_COMMONS); extraLicenseCardLayoutPanel.add(europeanaRightsPanel, EUROPEANA_RIGHTS_STATEMENTS); extraLicenseCardLayoutPanel.add(emptyPanel, EMPTY_PANEL); CardLayout cardLayout = (CardLayout) extraLicenseCardLayoutPanel.getLayout(); cardLayout.show(extraLicenseCardLayoutPanel, EMPTY_PANEL); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); conversionModeGroup = new ButtonGroup(); JRadioButton radioButton;// w ww . ja v a2 s .co m panel.add(new Label(this.labels.getString("edm.panel.label.choose.mode"))); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.mode.minimal")); radioButton.setActionCommand(MINIMAL); radioButton.setSelected(true); radioButton.addActionListener(new ConversionModeListener()); conversionModeGroup.add(radioButton); panel.add(radioButton); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.mode.full")); radioButton.setActionCommand(FULL); radioButton.addActionListener(new ConversionModeListener()); conversionModeGroup.add(radioButton); panel.add(radioButton); formPanel.add(panel); panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); cLevelIdSourceButtonGroup = new ButtonGroup(); panel.add(new Label(this.labels.getString("edm.generalOptionsForm.identifierSource.header"))); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.identifierSource.unitid")); radioButton.setActionCommand(UNITID); if (retrieveFromDb.retrieveCIdentifierSource().equals(radioButton.getActionCommand())) { radioButton.setSelected(true); } cLevelIdSourceButtonGroup.add(radioButton); panel.add(radioButton); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.identifierSource.cid")); radioButton.setActionCommand(CID); if (retrieveFromDb.retrieveCIdentifierSource().equals(radioButton.getActionCommand())) { radioButton.setSelected(true); } cLevelIdSourceButtonGroup.add(radioButton); panel.add(radioButton); formPanel.add(panel); panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); sourceOfFondsTitleGroup = new ButtonGroup(); determineDaoInformation(); panel.add(new Label(this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle"))); if (!this.batch && StringUtils.isBlank(ead2EdmInformation.getArchdescUnittitle()) && StringUtils.isBlank(ead2EdmInformation.getTitlestmtTitleproper())) { panel.add(new Label( this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.noSourceAvailable"))); } else { radioButton = new JRadioButton( this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.archdescUnittitle")); radioButton.setActionCommand(ARCHDESC_UNITTITLE); radioButton.setSelected(true); radioButton.addActionListener(new ConversionModeListener()); sourceOfFondsTitleGroup.add(radioButton); panel.add(radioButton); radioButton = new JRadioButton( this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.titlestmtTitleproper")); radioButton.setActionCommand(TITLESTMT_TITLEPROPER); radioButton.addActionListener(new ConversionModeListener()); sourceOfFondsTitleGroup.add(radioButton); panel.add(radioButton); } formPanel.add(panel); panel = new JPanel(new GridLayout(2, 2)); landingPageButtonGroup = new ButtonGroup(); panel.add(new Label(this.labels.getString("edm.generalOptionsForm.landingPages.header"))); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.landingPages.ape")); radioButton.setActionCommand(APE); if (retrieveFromDb.retrieveLandingPageBase().equals(APE_BASE)) { radioButton.setSelected(true); } landingPageButtonGroup.add(radioButton); panel.add(radioButton); panel.add(new Label()); JPanel otherPanel = new JPanel(new GridLayout(1, 2)); radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.landingPages.other")); radioButton.setActionCommand(OTHER); landingPageButtonGroup.add(radioButton); otherPanel.add(radioButton); landingPageTextArea = new JTextArea(); landingPageTextArea.setLineWrap(true); landingPageTextArea.setWrapStyleWord(true); if (!retrieveFromDb.retrieveLandingPageBase().equals(APE_BASE)) { radioButton.setSelected(true); landingPageTextArea.setText(retrieveFromDb.retrieveLandingPageBase()); } JScrollPane lptaScrollPane = new JScrollPane(landingPageTextArea); lptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); otherPanel.add(lptaScrollPane); panel.add(otherPanel); formPanel.add(panel); panel = new JPanel(new GridLayout(1, 1)); panel.add(new Label(labels.getString("ese.mandatoryFieldsInfo"))); panel.add(new Label("")); panel.setBorder(BLACK_LINE); formPanel.add(panel); panel = new JPanel(new GridLayout(1, 3)); panel.add(new Label(labels.getString("ese.dataProvider") + ":" + "*")); dataProviderTextArea = new JTextArea(); dataProviderTextArea.setLineWrap(true); dataProviderTextArea.setWrapStyleWord(true); JScrollPane dptaScrollPane = new JScrollPane(dataProviderTextArea); dptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel.add(dptaScrollPane); useExistingRepoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileRepository")); useExistingRepoCheckbox.setSelected(true); useExistingRepoCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); JPanel panel2 = new JPanel(new GridLayout(1, 1)); panel2.add(useExistingRepoCheckbox); if (!batch) { String repository = ead2EdmInformation.getRepository(); if (repository != null && !repository.equals("")) { dataProviderTextArea.setText(repository); } else { if (archdescRepository != null) { dataProviderTextArea.setText(archdescRepository); } else { useExistingRepoCheckbox.setSelected(false); } } } panel.add(panel2); panel.setBorder(BLACK_LINE); formPanel.add(panel); /* panel = new JPanel(new GridLayout(1, 3)); panel.add(new Label(labels.getString("ese.provider") + ":" + "*")); providerTextArea = new JTextArea(); providerTextArea.setLineWrap(true); providerTextArea.setWrapStyleWord(true); JScrollPane ptaScrollPane = new JScrollPane(providerTextArea); ptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel.add(ptaScrollPane); panel.add(new Label("")); panel.setBorder(BLACK_LINE); formPanel.add(panel); */ panel = new JPanel(new GridLayout(5, 3)); typeGroup = new ButtonGroup(); panel.add(new Label(labels.getString("ese.type") + ":" + "*")); String currentRoleType; if (batch) { currentRoleType = ""; } else { currentRoleType = ead2EdmInformation.getRoleType(); } radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.text")); if (currentRoleType.equals(EdmOptionsPanel.TEXT)) { radioButton.setSelected(true); } radioButton.setActionCommand(TEXT); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.image")); if (currentRoleType.equals(EdmOptionsPanel.IMAGE)) { radioButton.setSelected(true); } radioButton.setActionCommand(IMAGE); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.video")); if (currentRoleType.equals(EdmOptionsPanel.VIDEO)) { radioButton.setSelected(true); } radioButton.setActionCommand(VIDEO); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); useExistingDaoRoleCheckbox = new JCheckBox(labels.getString("ese.takeFromFileDaoRole")); useExistingDaoRoleCheckbox.setSelected(true); useExistingDaoRoleCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { } }); panel.add(useExistingDaoRoleCheckbox); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.sound")); if (currentRoleType.equals(EdmOptionsPanel.SOUND)) { radioButton.setSelected(true); } radioButton.setActionCommand(SOUND); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.threed")); if (currentRoleType.equals(EdmOptionsPanel.THREE_D)) { radioButton.setSelected(true); } radioButton.setActionCommand(THREE_D); radioButton.addActionListener(new ConversionModeListener()); typeGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); panel.setBorder(GREY_LINE); formPanel.add(panel); if (this.batch) { panel = new JPanel(new GridLayout(1, 3)); panel.add(new Label(labels.getString("ese.selectLanguage") + ":" + "*")); panel.add(languageBoxPanel); useExistingLanguageCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLanguage")); useExistingLanguageCheckbox.setSelected(true); useExistingLanguageCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); panel.add(useExistingLanguageCheckbox); panel.setBorder(BLACK_LINE); formPanel.add(panel); } else { inheritLanguagePanel = new JPanel(new GridLayout(1, 3)); inheritLanguagePanel.add(new Label(labels.getString("ese.inheritLanguage") + ":" + "*")); JPanel rbPanel = new JPanel(new GridLayout(4, 1)); inheritLanguageGroup = new ButtonGroup(); inhLanYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhLanYesRadioButton.setActionCommand(YES); inhLanYesRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); inheritLanguageGroup.add(inhLanYesRadioButton); rbPanel.add(inhLanYesRadioButton); inhLanNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhLanNoRadioButton.setActionCommand(NO); inhLanNoRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); inheritLanguageGroup.add(inhLanNoRadioButton); rbPanel.add(inhLanNoRadioButton); inhLanProvideRadioButton = new JRadioButton(labels.getString("ese.provide")); inhLanProvideRadioButton.setActionCommand(PROVIDE); inhLanProvideRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); inheritLanguageGroup.add(inhLanProvideRadioButton); rbPanel.add(inhLanProvideRadioButton); useExistingLanguageCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLanguage")); useExistingLanguageCheckbox.setSelected(true); useExistingLanguageCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); rbPanel.add(useExistingLanguageCheckbox); inheritLanguagePanel.add(rbPanel, BorderLayout.WEST); languageBoxPanel.setVisible(true); inheritLanguagePanel.add(languageBoxPanel, BorderLayout.EAST); inheritLanguagePanel.setBorder(BLACK_LINE); inheritLanguagePanel.setVisible(true); formPanel.add(inheritLanguagePanel); } // if (this.batch) { panel = new JPanel(new GridLayout(1, 3)); panel.add(new JLabel(labels.getString("edm.panel.license.inheritLicense") + ":" + "*")); useExistingRightsInfoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLicense")); useExistingRightsInfoCheckbox.setSelected(true); useExistingRightsInfoCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { //empty method on purpose } }); panel.add(useExistingRightsInfoCheckbox); panel.add(new JLabel()); panel.setBorder(BLACK_LINE); panel.setVisible(true); formPanel.add(panel); // } else { // panel = new JPanel(new GridLayout(3, 3)); // inheritLicenseGroup = new ButtonGroup(); // // panel.add(new Label(labels.getString("edm.panel.license.inheritLicense") + ":" + "*")); // inhLicYesRadioButton = new JRadioButton(labels.getString("ese.yes")); // inhLicYesRadioButton.setActionCommand(YES); //// inhLicYesRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); // inheritLicenseGroup.add(inhLicYesRadioButton); // panel.add(inhLicYesRadioButton); // panel.add(new JLabel()); // // panel.add(new JLabel()); // inhLicNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); // inhLicNoRadioButton.setActionCommand(NO); //// inhLicNoRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); // inheritLicenseGroup.add(inhLicNoRadioButton); // panel.add(inhLicNoRadioButton); // useExistingRightsInfoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLicense")); // useExistingRightsInfoCheckbox.setSelected(true); // useExistingRightsInfoCheckbox.addItemListener(new ItemListener() { // @Override // public void itemStateChanged(ItemEvent e) { // //empty method on purpose // } // }); // // panel.add(useExistingRightsInfoCheckbox); // // panel.add(new JLabel()); // inhLicProvideRadioButton = new JRadioButton(labels.getString("ese.provide")); // inhLicProvideRadioButton.setActionCommand(PROVIDE); //// inhLicProvideRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel)); // inheritLicenseGroup.add(inhLicProvideRadioButton); // panel.add(inhLicProvideRadioButton); // panel.add(new JLabel()); // // panel.setBorder(BLACK_LINE); // panel.setVisible(true); // formPanel.add(panel); // } JPanel mainLicensePanel = new JPanel(new BorderLayout()); panel = new JPanel(new GridLayout(5, 2)); licenseGroup = new ButtonGroup(); // String currentRightsInformation; // if (batch) { // currentRightsInformation = ""; // } else { // currentRightsInformation = ead2EdmInformation.getArchdescLicenceType(); // } panel.add(new Label(labels.getString("ese.specifyLicense") + ":" + "*")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc")); // if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(CREATIVE_COMMONS); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc.zero")); // if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS_CC0)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(CREATIVE_COMMONS_CC0); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc.public")); // if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS_PUBLIC_DOMAIN_MARK)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(CREATIVE_COMMONS_PUBLIC_DOMAIN_MARK); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.europeana.rights")); // if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(EUROPEANA_RIGHTS_STATEMENTS); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); panel.add(new JLabel("")); radioButton = new JRadioButton(this.labels.getString("edm.panel.label.out.copyright")); // if (currentRightsInformation.equals(EdmOptionsPanel.OUT_OF_COPYRIGHT)) { // radioButton.setSelected(true); // } radioButton.setActionCommand(EdmOptionsPanel.OUT_OF_COPYRIGHT); radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel)); licenseGroup.add(radioButton); panel.add(radioButton); mainLicensePanel.add(panel, BorderLayout.WEST); mainLicensePanel.add(extraLicenseCardLayoutPanel, BorderLayout.EAST); // if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS) || currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) { // cardLayout.show(extraLicenseCardLayoutPanel, currentRightsInformation); // if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS)) { // if (ead2EdmInformation.getArchdescLicenceLink().endsWith("rr-f/")) { // europeanaRightsComboBox.setSelectedIndex(0); // } else if (ead2EdmInformation.getArchdescLicenceLink().endsWith("orphan-work-eu/")) { // europeanaRightsComboBox.setSelectedIndex(1); // } else if (ead2EdmInformation.getArchdescLicenceLink().endsWith("rr-p/")) { // europeanaRightsComboBox.setSelectedIndex(2); // } else { // europeanaRightsComboBox.setSelectedIndex(3); // } // } else if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) { // // get respective items from EAD2EDMInfo and set panel items appropriately // } // } mainLicensePanel.setBorder(BLACK_LINE); formPanel.add(mainLicensePanel); panel = new JPanel(new GridLayout(1, 1)); panel.add(new Label(labels.getString("ese.specifyAdditionalRightsInfo") + ":")); additionalRightsTextArea = new JTextArea(); additionalRightsTextArea.setLineWrap(true); additionalRightsTextArea.setWrapStyleWord(true); JScrollPane artaScrollPane = new JScrollPane(additionalRightsTextArea); artaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel.add(artaScrollPane); panel.setBorder(GREY_LINE); formPanel.add(panel); inheritParentPanel = new JPanel(new GridLayout(2, 3)); inheritParentCheckbox = new JCheckBox(labels.getString("ese.inheritParent") + ":" + "*"); inheritParentCheckbox.setSelected(true); inheritParentCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { inhParYesRadioButton.setEnabled(true); inhParNoRadioButton.setEnabled(true); } if (e.getStateChange() == ItemEvent.DESELECTED) { inhParYesRadioButton.setEnabled(false); inhParNoRadioButton.setEnabled(false); } } }); inheritParentPanel.add(inheritParentCheckbox); inheritParentGroup = new ButtonGroup(); inhParYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhParYesRadioButton.setActionCommand(YES); inheritParentGroup.add(inhParYesRadioButton); inheritParentPanel.add(inhParYesRadioButton); inheritParentPanel.add(new JLabel("")); inhParNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhParNoRadioButton.setActionCommand(NO); inheritParentGroup.add(inhParNoRadioButton); inheritParentPanel.add(inhParNoRadioButton); inheritParentPanel.setBorder(GREY_LINE); inheritParentPanel.setVisible(false); formPanel.add(inheritParentPanel); inheritOriginationPanel = new JPanel(new GridLayout(2, 3)); inheritOriginationCheckbox = new JCheckBox(labels.getString("ese.inheritOrigination") + ":" + "*"); inheritOriginationCheckbox.setSelected(true); inheritOriginationCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { inhOriYesRadioButton.setEnabled(true); inhOriNoRadioButton.setEnabled(true); } if (e.getStateChange() == ItemEvent.DESELECTED) { inhOriYesRadioButton.setEnabled(false); inhOriNoRadioButton.setEnabled(false); } } }); inheritOriginationPanel.add(inheritOriginationCheckbox); inheritOriginationGroup = new ButtonGroup(); inhOriYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhOriYesRadioButton.setActionCommand(YES); inheritOriginationGroup.add(inhOriYesRadioButton); inheritOriginationPanel.add(inhOriYesRadioButton); inheritOriginationPanel.add(new JLabel("")); inhOriNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhOriNoRadioButton.setActionCommand(NO); inheritOriginationGroup.add(inhOriNoRadioButton); inheritOriginationPanel.add(inhOriNoRadioButton); inheritOriginationPanel.setBorder(BLACK_LINE); inheritOriginationPanel.setVisible(false); formPanel.add(inheritOriginationPanel); inheritUnittitlePanel = new JPanel(new GridLayout(2, 3)); inheritUnittitleCheckbox = new JCheckBox(labels.getString("ese.inheritUnittitle") + ":" + "*"); inheritUnittitleCheckbox.setSelected(true); inheritUnittitleCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { inhTitleYesRadioButton.setEnabled(true); inhTitleNoRadioButton.setEnabled(true); } if (e.getStateChange() == ItemEvent.DESELECTED) { inhTitleYesRadioButton.setEnabled(false); inhTitleNoRadioButton.setEnabled(false); } } }); inheritUnittitlePanel.add(inheritUnittitleCheckbox); inheritUnittitleGroup = new ButtonGroup(); inhTitleYesRadioButton = new JRadioButton(labels.getString("ese.yes")); inhTitleYesRadioButton.setActionCommand(YES); inheritUnittitleGroup.add(inhTitleYesRadioButton); inheritUnittitlePanel.add(inhTitleYesRadioButton); inheritUnittitlePanel.add(new JLabel("")); inhTitleNoRadioButton = new JRadioButton(labels.getString("ese.no"), true); inhTitleNoRadioButton.setActionCommand(NO); inheritUnittitleGroup.add(inhTitleNoRadioButton); inheritUnittitlePanel.add(inhTitleNoRadioButton); inheritUnittitlePanel.setBorder(BLACK_LINE); inheritUnittitlePanel.setVisible(false); formPanel.add(inheritUnittitlePanel); JButton createEdmBtn = new JButton(labels.getString("ese.createEseBtn")); JButton cancelBtn = new JButton(labels.getString("ese.cancelBtn")); createEdmBtn.addActionListener(new CreateEdmActionListener()); cancelBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (Map.Entry<String, FileInstance> entry : fileInstances.entrySet()) { FileInstance fileInstance = entry.getValue(); fileInstance.setEdm(false); } dataPreparationToolGUI.enableEdmConversionBtn(); if (batch) { dataPreparationToolGUI.enableAllBatchBtns(); } dataPreparationToolGUI.enableRadioButtons(); close(); } }); JPanel buttonPanel = new JPanel(new GridLayout(1, 5)); buttonPanel.add(new JLabel("")); buttonPanel.add(cancelBtn); buttonPanel.add(new JLabel("")); buttonPanel.add(createEdmBtn); buttonPanel.add(new JLabel("")); add(formPanel, BorderLayout.CENTER); add(buttonPanel, BorderLayout.SOUTH); }
From source file:LightTest.java
public void addUiToPanel(Panel panel) { Button colorButton = new Button("Color"); colorButton.addActionListener(this); panel.add(colorButton);/*from w w w. jav a 2 s.c o m*/ m_EnableCheck = new Checkbox("Enable", true); m_EnableCheck.addItemListener(this); panel.add(m_EnableCheck); panel.add(new Label("Bounds:")); panel.add(new Label("X:")); m_XTextField = new TextField(3); panel.add(m_XTextField); panel.add(new Label("Y:")); m_YTextField = new TextField(3); panel.add(m_YTextField); panel.add(new Label("Z:")); m_ZTextField = new TextField(3); panel.add(m_ZTextField); panel.add(new Label("Radius:")); m_RadiusTextField = new TextField(4); panel.add(m_RadiusTextField); Button updateButton = new Button("Update"); updateButton.addActionListener(this); panel.add(updateButton); synchLightToUi(); }
From source file:LightTest.java
public void addUiToPanel(Panel panel) { m_XPositionTextField = new TextField(3); m_YPositionTextField = new TextField(3); m_ZPositionTextField = new TextField(3); m_ConstantAttenuationTextField = new TextField(3); m_LinearAttenuationTextField = new TextField(3); m_QuadraticAttenuationTextField = new TextField(3); panel.add(new Label("Position:")); panel.add(new Label("X:")); panel.add(m_XPositionTextField);//from w w w . ja va2 s . c om panel.add(new Label("Y:")); panel.add(m_YPositionTextField); panel.add(new Label("Z:")); panel.add(m_ZPositionTextField); panel.add(new Label("Attenuation:")); panel.add(new Label("Constant:")); panel.add(m_ConstantAttenuationTextField); panel.add(new Label("Linear:")); panel.add(m_LinearAttenuationTextField); panel.add(new Label("Quadratic:")); panel.add(m_QuadraticAttenuationTextField); super.addUiToPanel(panel); }
From source file:FourByFour.java
/** * Initialization/*from w ww .ja v a 2s .co m*/ */ public void init() { // Set the port number. port = 4111; // Set the graphics window size. width = 350; height = 350; // Set the weighting factors used for scoring. level_weight = 1311; move_weight = 111; time_weight = 1000; // Create the "base" color for the AWT components. setBackground(new Color(200, 200, 200)); // Read the instructions file. if (appletFlag) { // Get the host from which this applet came. host = getCodeBase().getHost(); try { inStream = new BufferedInputStream(new URL(getCodeBase(), "instructions.txt").openStream(), 8192); text = new byte[5000]; int character = inStream.read(); int count = 0; while (character != -1) { text[count++] = (byte) character; character = inStream.read(); } textString = new String(text); inStream.close(); } catch (Exception e) { System.out.println("Error: " + e.toString()); } } else { try { inStream = new BufferedInputStream(new FileInputStream("instructions.txt")); text = new byte[5000]; int character = inStream.read(); int count = 0; while (character != -1) { text[count++] = (byte) character; character = inStream.read(); } textString = new String(text); inStream.close(); } catch (Exception e) { System.out.println("Error: " + e.toString()); } } // Read the high-scores file. places = new int[20]; scores = new int[20]; names = new String[20]; if (appletFlag) { try { inStream = new BufferedInputStream(new URL(getCodeBase(), "scores.txt").openStream(), 8192); Reader read = new BufferedReader(new InputStreamReader(inStream)); StreamTokenizer st = new StreamTokenizer(read); st.whitespaceChars(32, 44); st.eolIsSignificant(false); int count = 0; int token = st.nextToken(); boolean scoreFlag = true; String string; while (count < 20) { places[count] = (int) st.nval; string = new String(""); token = st.nextToken(); while (token == StreamTokenizer.TT_WORD) { string += st.sval; string += " "; token = st.nextToken(); } names[count] = string; scores[count] = (int) st.nval; token = st.nextToken(); count++; } inStream.close(); } catch (Exception e) { System.out.println("Error: " + e.toString()); } } else { try { inStream = new BufferedInputStream(new FileInputStream("scores.txt")); Reader read = new BufferedReader(new InputStreamReader(inStream)); StreamTokenizer st = new StreamTokenizer(read); st.whitespaceChars(32, 44); st.eolIsSignificant(false); int count = 0; int token = st.nextToken(); boolean scoreFlag = true; String string; while (count < 20) { places[count] = (int) st.nval; string = new String(""); token = st.nextToken(); while (token == StreamTokenizer.TT_WORD) { string += st.sval; string += " "; token = st.nextToken(); } names[count] = string; scores[count] = (int) st.nval; token = st.nextToken(); count++; } inStream.close(); } catch (Exception e) { System.out.println("Error: " + e.toString()); } } // The positions object sets up the switch nodes which // control the rendering of the player's positions. positions = new Positions(); // Create the game board object which is responsible // for keeping track of the moves on the game board // and determining what move the computer should make. board = new Board(this, positions, width, height); positions.setBoard(board); // Create a 2D graphics canvas. canvas2D = new Canvas2D(board); canvas2D.setSize(width, height); canvas2D.setLocation(width + 10, 5); canvas2D.addMouseListener(canvas2D); board.setCanvas(canvas2D); // Create the 2D backbuffer backbuffer2D = createImage(width, height); canvas2D.setBuffer(backbuffer2D); // Create a 3D graphics canvas. canvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); canvas3D.setSize(width, height); canvas3D.setLocation(5, 5); // Create the scene branchgroup. BranchGroup scene3D = createScene3D(); // Create a universe with the Java3D universe utility. universe = new SimpleUniverse(canvas3D); universe.addBranchGraph(scene3D); // Use parallel projection. View view = universe.getViewer().getView(); view.setProjectionPolicy(View.PARALLEL_PROJECTION); // Set the universe Transform3D object. TransformGroup tg = universe.getViewingPlatform().getViewPlatformTransform(); Transform3D transform = new Transform3D(); transform.set(65.f, new Vector3f(0.0f, 0.0f, 400.0f)); tg.setTransform(transform); // Create the canvas container. c_container = new Panel(); c_container.setSize(720, 360); c_container.setLocation(0, 0); c_container.setVisible(true); c_container.setLayout(null); add(c_container); // Add the 2D and 3D canvases to the container. c_container.add(canvas2D); c_container.add(canvas3D); // Turn off the layout manager, widgets will be sized // and positioned explicitly. setLayout(null); // Create the button container. b_container = new Panel(); b_container.setSize(720, 70); b_container.setLocation(0, 360); b_container.setVisible(true); b_container.setLayout(null); // Create the buttons. instruct_button = new Button("Instructions"); instruct_button.setSize(135, 25); instruct_button.setLocation(10, 10); instruct_button.setVisible(true); instruct_button.addActionListener(this); new_button = new Button("New Game"); new_button.setSize(135, 25); new_button.setLocation(150, 10); new_button.setVisible(true); new_button.addActionListener(this); undo_button = new Button("Undo Move"); undo_button.setSize(135, 25); undo_button.setLocation(290, 10); undo_button.setVisible(true); undo_button.addActionListener(this); skill_button = new Button("Skill Level"); skill_button.setSize(135, 25); skill_button.setLocation(430, 10); skill_button.setVisible(true); skill_button.addActionListener(this); high_button = new Button("High Scores"); high_button.setSize(135, 25); high_button.setLocation(570, 10); high_button.setVisible(true); high_button.addActionListener(this); b_container.add(new_button); b_container.add(undo_button); b_container.add(skill_button); b_container.add(high_button); b_container.add(instruct_button); // Add the button container to the applet. add(b_container); // Create the "Skill Level" dialog box. skill_panel = new Panel(); skill_panel.setSize(400, 300); skill_panel.setLocation(200, 20); skill_panel.setLayout(null); skill_label = new Label("Pick your skill level:"); skill_label.setSize(200, 25); skill_label.setLocation(25, 20); skill_label.setVisible(true); skill_panel.add(skill_label); group = new CheckboxGroup(); Checkbox skill_1 = new Checkbox("Babe in the Woods ", group, false); Checkbox skill_2 = new Checkbox("Walk and Chew Gum ", group, false); Checkbox skill_3 = new Checkbox("Jeopardy Contestant ", group, false); Checkbox skill_4 = new Checkbox("Rocket Scientist ", group, false); Checkbox skill_5 = new Checkbox("Be afraid, be very afraid", group, true); skill_1.setSize(170, 25); skill_1.setLocation(80, 60); skill_1.setVisible(true); skill_2.setSize(170, 25); skill_2.setLocation(80, 100); skill_2.setVisible(true); skill_3.setSize(170, 25); skill_3.setLocation(80, 140); skill_3.setVisible(true); skill_4.setSize(170, 25); skill_4.setLocation(80, 180); skill_4.setVisible(true); skill_5.setSize(170, 25); skill_5.setLocation(80, 220); skill_5.setVisible(true); skill_return_button = new Button("Return"); skill_return_button.setSize(120, 25); skill_return_button.setLocation(300, 370); skill_return_button.setVisible(false); skill_return_button.addActionListener(this); skill_panel.add(skill_1); skill_panel.add(skill_2); skill_panel.add(skill_3); skill_panel.add(skill_4); skill_panel.add(skill_5); skill_panel.setVisible(false); add(skill_return_button); add(skill_panel); // Create the "Instructions" panel. instruct_return_button = new Button("Return"); instruct_return_button.setLocation(300, 370); instruct_return_button.setSize(120, 25); instruct_return_button.setVisible(false); instruct_return_button.addActionListener(this); instruct_text = new TextArea(textString, 100, 200, TextArea.SCROLLBARS_VERTICAL_ONLY); instruct_text.setSize(715, 350); instruct_text.setLocation(0, 0); instruct_text.setVisible(false); add(instruct_text); add(instruct_return_button); high_panel = new Panel(); high_panel.setSize(715, 350); high_panel.setLocation(0, 0); high_panel.setVisible(false); high_panel.setLayout(null); high_label = new Label("High Scores"); high_label.setLocation(330, 5); high_label.setSize(200, 30); high_label.setVisible(true); high_panel.add(high_label); high_places = new Label[20]; high_names = new Label[20]; high_scores = new Label[20]; for (int i = 0; i < 20; i++) { high_places[i] = new Label(Integer.toString(i + 1)); high_places[i].setSize(20, 30); high_places[i].setVisible(true); high_names[i] = new Label(names[i]); high_names[i].setSize(150, 30); high_names[i].setVisible(true); high_scores[i] = new Label(Integer.toString(scores[i])); high_scores[i].setSize(150, 30); high_scores[i].setVisible(true); if (i < 10) { high_places[i].setLocation(70, i * 30 + 40); high_names[i].setLocation(100, i * 30 + 40); high_scores[i].setLocation(260, i * 30 + 40); } else { high_places[i].setLocation(425, (i - 10) * 30 + 40); high_names[i].setLocation(455, (i - 10) * 30 + 40); high_scores[i].setLocation(615, (i - 10) * 30 + 40); } high_panel.add(high_places[i]); high_panel.add(high_names[i]); high_panel.add(high_scores[i]); } high_return_button = new Button("Return"); high_return_button.setSize(120, 25); high_return_button.setLocation(300, 370); high_return_button.setVisible(false); high_return_button.addActionListener(this); add(high_return_button); add(high_panel); // Create the "Winner" dialog box winner_panel = new Panel(); winner_panel.setLayout(null); winner_panel.setSize(600, 500); winner_panel.setLocation(0, 0); winner_return_button = new Button("Return"); winner_return_button.setSize(120, 25); winner_return_button.setLocation(300, 360); winner_return_button.addActionListener(this); winner_panel.add(winner_return_button); winner_label = new Label(""); winner_label.setSize(200, 30); winner_label.setLocation(270, 110); winner_score_label = new Label(""); winner_score_label.setSize(200, 30); winner_top_label = new Label("You have a score in the top 20."); winner_top_label.setSize(200, 25); winner_top_label.setLocation(260, 185); winner_top_label.setVisible(false); winner_name_label = new Label("Enter your name here:"); winner_name_label.setSize(150, 25); winner_name_label.setLocation(260, 210); winner_name_label.setVisible(false); winner_name = new TextField(""); winner_name.setSize(200, 30); winner_name.setLocation(260, 240); winner_name.setVisible(false); winner_panel.add(winner_label); winner_panel.add(winner_score_label); winner_panel.add(winner_top_label); winner_panel.add(winner_name_label); winner_panel.add(winner_name); winner_panel.setVisible(false); add(winner_panel); }