public PropertyPanel(String title, Properties properties) { super(); setBorder(new TitledBorder(BorderFactory.createEtchedBorder(), title)); setLayout(new GridLayout(1, 1, 10, 10)); JTextArea area = new JTextArea(Math.min(properties.size(), 20), 40); area.setEditable(false); area.setOpaque(false); area.setTabSize(16); Iterator iter = properties.keySet().iterator(); if (iter.hasNext()) { // first line String key = (String) iter.next(); area.append(key); area.append("\t"); area.append(properties.getProperty(key)); } while (iter.hasNext()) { // remaining lines area.append("\n"); String key = (String) iter.next(); area.append(key); area.append("\t"); area.append(properties.getProperty(key)); } add(new JScrollPane(area)); }
/** Create and add Clippy's output text */ public void addClippyTxt() { clippyTxt.setLineWrap(true); clippyTxt.setWrapStyleWord(true); clippyTxt.setEditable(false); clippyTxt.setFont(txtFont); clippyTxt.setAlignmentX(JTextArea.CENTER_ALIGNMENT); clippyTxt.setAlignmentY(JTextArea.CENTER_ALIGNMENT); clippyTxt.setBorder(null); clippyTxt.setSize(105, 35); clippyTxt.setLocation(25, 45); clippyTxt.setOpaque(false); lpane.add(clippyTxt, new Integer(1), 0); }
public ButtonsRenderer(DefaultListModel<E> model) { super(new BorderLayout()); this.model = model; setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); setOpaque(true); label.setLineWrap(true); label.setOpaque(false); add(label); Box box = Box.createHorizontalBox(); for (JButton b : Arrays.asList(deleteButton, copyButton)) { b.setFocusable(false); b.setRolloverEnabled(false); box.add(b); box.add(Box.createHorizontalStrut(5)); } add(box, BorderLayout.EAST); }
public PartitionModelPanel(final PartitionSubstitutionModel partitionModel) { super(12, (OSType.isMac() ? 6 : 24)); this.model = partitionModel; initCodonPartitionComponents(); PanelUtils.setupComponent(nucSubstCombo); nucSubstCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setNucSubstitutionModel((NucModelType) nucSubstCombo.getSelectedItem()); } }); nucSubstCombo.setToolTipText("<html>Select the type of nucleotide substitution model.</html>"); PanelUtils.setupComponent(aaSubstCombo); aaSubstCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { AminoAcidModelType type = (AminoAcidModelType) aaSubstCombo.getSelectedItem(); model.setAaSubstitutionModel(type); citationText.setText(type.getCitation().toString()); } }); aaSubstCombo.setToolTipText("<html>Select the type of amino acid substitution model.</html>"); PanelUtils.setupComponent(binarySubstCombo); binarySubstCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setBinarySubstitutionModel((BinaryModelType) binarySubstCombo.getSelectedItem()); useAmbiguitiesTreeLikelihoodCheck.setSelected( binarySubstCombo.getSelectedItem() == BinaryModelType.BIN_COVARION); useAmbiguitiesTreeLikelihoodCheck.setEnabled( binarySubstCombo.getSelectedItem() != BinaryModelType.BIN_COVARION); } }); binarySubstCombo.setToolTipText("<html>Select the type of binary substitution model.</html>"); PanelUtils.setupComponent(useAmbiguitiesTreeLikelihoodCheck); useAmbiguitiesTreeLikelihoodCheck.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setUseAmbiguitiesTreeLikelihood(useAmbiguitiesTreeLikelihoodCheck.isSelected()); } }); useAmbiguitiesTreeLikelihoodCheck.setToolTipText( "<html>Detemine useAmbiguities in < treeLikelihood > .</html>"); PanelUtils.setupComponent(frequencyCombo); frequencyCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setFrequencyPolicy((FrequencyPolicyType) frequencyCombo.getSelectedItem()); } }); frequencyCombo.setToolTipText( "<html>Select the policy for determining the base frequencies.</html>"); PanelUtils.setupComponent(heteroCombo); heteroCombo.setToolTipText( "<html>Select the type of site-specific rate<br>heterogeneity model.</html>"); heteroCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { boolean gammaHetero = heteroCombo.getSelectedIndex() == 1 || heteroCombo.getSelectedIndex() == 3; model.setGammaHetero(gammaHetero); model.setInvarHetero( heteroCombo.getSelectedIndex() == 2 || heteroCombo.getSelectedIndex() == 3); if (gammaHetero) { gammaCatLabel.setEnabled(true); gammaCatCombo.setEnabled(true); } else { gammaCatLabel.setEnabled(false); gammaCatCombo.setEnabled(false); } if (codingCombo.getSelectedIndex() != 0) { heteroUnlinkCheck.setEnabled(heteroCombo.getSelectedIndex() != 0); heteroUnlinkCheck.setSelected(heteroCombo.getSelectedIndex() != 0); } } }); PanelUtils.setupComponent(gammaCatCombo); gammaCatCombo.setToolTipText( "<html>Select the number of categories to use for<br>the discrete gamma rate heterogeneity model.</html>"); gammaCatCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setGammaCategories(gammaCatCombo.getSelectedIndex() + 4); } }); setYang96Button = new JButton("Use Yang96 model"); setYang96Button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { setYang96Model(); } }); PanelUtils.setupComponent(setYang96Button); setYang96Button.setToolTipText( "<html>Sets a 3 codon-position model with independent GTR and Gamma as described in<br>" + "Yang (1996) <i>J Mol Evol</i> <b>42</b>: 587–596. This model is named 3' in this paper.</html>"); setSRD06Button = new JButton("Use SRD06 model"); setSRD06Button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ev) { setSRD06Model(); } }); PanelUtils.setupComponent(setSRD06Button); setSRD06Button.setToolTipText( "<html>Sets the SRD06 model as described in<br>" + "Shapiro, Rambaut & Drummond (2006) <i>MBE</i> <b>23</b>: 7-9.</html>"); citationText = new JTextArea(1, 40); citationText.setLineWrap(true); citationText.setWrapStyleWord(true); citationText.setEditable(false); citationText.setFont(this.getFont()); citationText.setOpaque(false); AminoAcidModelType type = (AminoAcidModelType) aaSubstCombo.getSelectedItem(); citationText.setText(type.getCitation().toString()); dolloCheck.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { if (dolloCheck.isSelected()) { binarySubstCombo.setSelectedIndex(0); binarySubstCombo.setEnabled(false); useAmbiguitiesTreeLikelihoodCheck.setSelected(true); useAmbiguitiesTreeLikelihoodCheck.setEnabled(false); frequencyCombo.setEnabled(false); frequencyCombo.setSelectedItem(FrequencyPolicyType.EMPIRICAL); heteroCombo.setSelectedIndex(0); heteroCombo.setEnabled(false); model.setBinarySubstitutionModel(BinaryModelType.BIN_DOLLO); model.setDolloModel(true); DolloComponentOptions comp = (DolloComponentOptions) model.getOptions().getComponentOptions(DolloComponentOptions.class); comp.createParameters(model.getOptions()); comp.setActive(true); } else { binarySubstCombo.setEnabled(true); useAmbiguitiesTreeLikelihoodCheck.setEnabled(true); frequencyCombo.setEnabled(true); heteroCombo.setEnabled(true); model.setBinarySubstitutionModel( (BinaryModelType) binarySubstCombo.getSelectedItem()); model.setDolloModel(false); } } }); PanelUtils.setupComponent(dolloCheck); // dolloCheck.addChangeListener(new ChangeListener() { // public void stateChanged(ChangeEvent e) { // model.setDolloModel(true); // } // }); dolloCheck.setEnabled(true); dolloCheck.setToolTipText( "<html>Activates a Stochastic Dollo model as described in<br>" + "Alekseyenko, Lee & Suchard (2008) <i>Syst Biol</i> <b>57</b>: 772-784.</html>"); PanelUtils.setupComponent(discreteTraitSiteModelCombo); discreteTraitSiteModelCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setDiscreteSubstType( (DiscreteSubstModelType) discreteTraitSiteModelCombo.getSelectedItem()); } }); PanelUtils.setupComponent(continuousTraitSiteModelCombo); continuousTraitSiteModelCombo.setToolTipText( "<html>Select the model of continuous random walk, either homogenous<br>" + "or relaxed random walk (RRW) with a choice of distributions.</html>"); continuousTraitSiteModelCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setContinuousSubstModelType( (ContinuousSubstModelType) continuousTraitSiteModelCombo.getSelectedItem()); } }); PanelUtils.setupComponent(latLongCheck); latLongCheck.setToolTipText( "<html>Specify whether this is a geographical trait representing <br>" + "latitude and longitude. Provides appropriate statistics to log file.</html>"); latLongCheck.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setIsLatitudeLongitude(latLongCheck.isSelected()); } }); latLongCheck.setEnabled(false); PanelUtils.setupComponent(useLambdaCheck); useLambdaCheck.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { ContinuousComponentOptions component = (ContinuousComponentOptions) model.getOptions().getComponentOptions(ContinuousComponentOptions.class); component.setUseLambda(model, useLambdaCheck.isSelected()); } }); useLambdaCheck.setToolTipText( "<html>Estimate degree of phylogenetic correlation in continuous traits using <br>" + "a tree transform. Inspired by Pagel (1999), described in Lemey et al (2013) <i>in prep</i></html>"); PanelUtils.setupComponent(activateBSSVS); activateBSSVS.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setActivateBSSVS(activateBSSVS.isSelected()); } }); activateBSSVS.setToolTipText( "<html>Activates Bayesian stochastic search variable selection on the rates as described in<br>" + "Lemey, Rambaut, Drummond & Suchard (2009) <i>PLoS Computational Biology</i> <b>5</b>: e1000520</html>"); // ============ micro-sat ================ microsatName.setColumns(30); microsatName.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { model.getMicrosatellite().setName(microsatName.getText()); } }); microsatMax.setColumns(10); microsatMax.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { model.getMicrosatellite().setMax(Integer.parseInt(microsatMax.getText())); } }); microsatMin.setColumns(10); microsatMin.addKeyListener( new java.awt.event.KeyListener() { public void keyTyped(KeyEvent e) {} public void keyPressed(KeyEvent e) {} public void keyReleased(KeyEvent e) { model.getMicrosatellite().setMin(Integer.parseInt(microsatMin.getText())); } }); PanelUtils.setupComponent(shareMicroSatCheck); shareMicroSatCheck.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { model.getOptions().shareMicroSat = shareMicroSatCheck.isSelected(); if (shareMicroSatCheck.isSelected()) { model.getOptions().shareMicroSat(); } else { model.getOptions().unshareMicroSat(); } setOptions(); } }); PanelUtils.setupComponent(rateProportionCombo); rateProportionCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setRatePorportion( (MicroSatModelType.RateProportionality) rateProportionCombo.getSelectedItem()); } }); // rateProportionCombo.setToolTipText("<html>Select the type of microsatellite substitution // model.</html>"); PanelUtils.setupComponent(mutationBiasCombo); mutationBiasCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setMutationBias( (MicroSatModelType.MutationalBias) mutationBiasCombo.getSelectedItem()); } }); PanelUtils.setupComponent(phaseCombo); phaseCombo.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent ev) { model.setPhase((MicroSatModelType.Phase) phaseCombo.getSelectedItem()); } }); setupPanel(); setOpaque(false); }
/** Initializes the <tt>NewStatusMessageDialog</tt> by adding the buttons, fields, etc. */ private void init() { JLabel messageLabel = new JLabel(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE")); JPanel dataPanel = new TransparentPanel(new BorderLayout(5, 5)); JTextArea infoArea = new JTextArea(GuiActivator.getResources().getI18NString("service.gui.STATUS_MESSAGE_INFO")); JLabel infoTitleLabel = new JLabel(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE")); JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1)); JButton okButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.OK")); JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); this.setTitle(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE")); this.getRootPane().setDefaultButton(okButton); this.setPreferredSize(new Dimension(500, 200)); infoArea.setEditable(false); infoArea.setLineWrap(true); infoArea.setWrapStyleWord(true); infoArea.setOpaque(false); dataPanel.add(messageLabel, BorderLayout.WEST); messageTextField.setText(presenceOpSet.getCurrentStatusMessage()); dataPanel.add(messageTextField, BorderLayout.CENTER); infoTitleLabel.setHorizontalAlignment(JLabel.CENTER); infoTitleLabel.setFont(infoTitleLabel.getFont().deriveFont(Font.BOLD, 18.0f)); labelsPanel.add(infoTitleLabel); labelsPanel.add(infoArea); labelsPanel.add(dataPanel); messagePanel = new TransparentPanel(new GridBagLayout()); GridBagConstraints messagePanelConstraints = new GridBagConstraints(); messagePanelConstraints.anchor = GridBagConstraints.NORTHWEST; messagePanelConstraints.fill = GridBagConstraints.NONE; messagePanelConstraints.gridx = 0; messagePanelConstraints.gridy = 0; messagePanelConstraints.insets = new Insets(5, 0, 5, 10); messagePanelConstraints.weightx = 0; messagePanelConstraints.weighty = 0; messagePanel.add( new ImageCanvas(ImageLoader.getImage(ImageLoader.RENAME_DIALOG_ICON)), messagePanelConstraints); messagePanelConstraints.anchor = GridBagConstraints.NORTH; messagePanelConstraints.fill = GridBagConstraints.HORIZONTAL; messagePanelConstraints.gridx = 1; messagePanelConstraints.insets = new Insets(0, 0, 0, 0); messagePanelConstraints.weightx = 1; messagePanel.add(labelsPanel, messagePanelConstraints); okButton.setName("ok"); cancelButton.setName("cancel"); okButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.OK")); cancelButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.CANCEL")); okButton.addActionListener(this); cancelButton.addActionListener(this); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); JPanel mainPanel = new TransparentPanel(new GridBagLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10)); GridBagConstraints mainPanelConstraints = new GridBagConstraints(); mainPanelConstraints.anchor = GridBagConstraints.NORTH; mainPanelConstraints.fill = GridBagConstraints.BOTH; mainPanelConstraints.gridx = 0; mainPanelConstraints.gridy = 0; mainPanelConstraints.weightx = 1; mainPanelConstraints.weighty = 1; mainPanel.add(messagePanel, mainPanelConstraints); mainPanelConstraints.anchor = GridBagConstraints.SOUTHEAST; mainPanelConstraints.fill = GridBagConstraints.NONE; mainPanelConstraints.gridy = 1; mainPanelConstraints.weightx = 0; mainPanelConstraints.weighty = 0; mainPanel.add(buttonsPanel, mainPanelConstraints); this.getContentPane().add(mainPanel); }
/** Constructs the <tt>LoginWindow</tt>. */ private void init() { String title; if (windowTitle != null) title = windowTitle; else title = DesktopUtilActivator.getResources() .getI18NString("service.gui.AUTHENTICATION_WINDOW_TITLE", new String[] {server}); String text; if (windowText != null) text = windowText; else text = DesktopUtilActivator.getResources() .getI18NString("service.gui.AUTHENTICATION_REQUESTED_SERVER", new String[] {server}); String uinText; if (usernameLabelText != null) uinText = usernameLabelText; else uinText = DesktopUtilActivator.getResources().getI18NString("service.gui.IDENTIFIER"); String passText; if (passwordLabelText != null) passText = passwordLabelText; else passText = DesktopUtilActivator.getResources().getI18NString("service.gui.PASSWORD"); setTitle(title); infoTextArea.setEditable(false); infoTextArea.setOpaque(false); infoTextArea.setLineWrap(true); infoTextArea.setWrapStyleWord(true); infoTextArea.setFont(infoTextArea.getFont().deriveFont(Font.BOLD)); infoTextArea.setText(text); infoTextArea.setAlignmentX(0.5f); JLabel uinLabel = new JLabel(uinText); uinLabel.setFont(uinLabel.getFont().deriveFont(Font.BOLD)); JLabel passwdLabel = new JLabel(passText); passwdLabel.setFont(passwdLabel.getFont().deriveFont(Font.BOLD)); TransparentPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8)); labelsPanel.add(uinLabel); labelsPanel.add(passwdLabel); TransparentPanel textFieldsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8)); textFieldsPanel.add(uinValue); textFieldsPanel.add(passwdField); JPanel southFieldsPanel = new TransparentPanel(new GridLayout(1, 2)); this.rememberPassCheckBox.setOpaque(false); this.rememberPassCheckBox.setBorder(null); southFieldsPanel.add(rememberPassCheckBox); if (signupLink != null && signupLink.length() > 0) southFieldsPanel.add( createWebSignupLabel( DesktopUtilActivator.getResources().getI18NString("plugin.simpleaccregwizz.SIGNUP"), signupLink)); else southFieldsPanel.add(new JLabel()); boolean allowRememberPassword = true; String allowRemPassStr = DesktopUtilActivator.getResources().getSettingsString(PNAME_ALLOW_SAVE_PASSWORD); if (allowRemPassStr != null) { allowRememberPassword = Boolean.parseBoolean(allowRemPassStr); } allowRememberPassword = DesktopUtilActivator.getConfigurationService() .getBoolean(PNAME_ALLOW_SAVE_PASSWORD, allowRememberPassword); setAllowSavePassword(allowRememberPassword); JPanel buttonPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); buttonPanel.add(loginButton); buttonPanel.add(cancelButton); JPanel southEastPanel = new TransparentPanel(new BorderLayout()); southEastPanel.add(buttonPanel, BorderLayout.EAST); TransparentPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10)); mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 20)); JPanel mainFieldsPanel = new TransparentPanel(new BorderLayout(0, 10)); mainFieldsPanel.add(labelsPanel, BorderLayout.WEST); mainFieldsPanel.add(textFieldsPanel, BorderLayout.CENTER); mainFieldsPanel.add(southFieldsPanel, BorderLayout.SOUTH); mainPanel.add(infoTextArea, BorderLayout.NORTH); mainPanel.add(mainFieldsPanel, BorderLayout.CENTER); mainPanel.add(southEastPanel, BorderLayout.SOUTH); this.getContentPane().add(mainPanel, BorderLayout.EAST); this.loginButton.setName("ok"); this.cancelButton.setName("cancel"); if (loginButton.getPreferredSize().width > cancelButton.getPreferredSize().width) cancelButton.setPreferredSize(loginButton.getPreferredSize()); else loginButton.setPreferredSize(cancelButton.getPreferredSize()); this.loginButton.setMnemonic( DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.OK")); this.cancelButton.setMnemonic( DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.CANCEL")); this.loginButton.addActionListener(this); this.cancelButton.addActionListener(this); this.getRootPane().setDefaultButton(loginButton); }
// initializes the internal component of the translator protected void jbInit() { this.getContentPane().setLayout(new GridBagLayout()); loadButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { loadButton_actionPerformed(e); } }); loadButton.setMaximumSize(new Dimension(39, 39)); loadButton.setMinimumSize(new Dimension(39, 39)); loadButton.setPreferredSize(new Dimension(39, 39)); loadButton.setSize(new Dimension(39, 39)); loadButton.setToolTipText("Load Source File"); loadButton.setIcon(loadIcon); saveButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { saveButton_actionPerformed(e); } }); saveButton.setMaximumSize(new Dimension(39, 39)); saveButton.setMinimumSize(new Dimension(39, 39)); saveButton.setPreferredSize(new Dimension(39, 39)); saveButton.setSize(new Dimension(39, 39)); saveButton.setToolTipText("Save Destination File"); saveButton.setIcon(saveIcon); singleStepButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { singleStepButton_actionPerformed(e); } }); singleStepButton.setMaximumSize(new Dimension(39, 39)); singleStepButton.setMinimumSize(new Dimension(39, 39)); singleStepButton.setPreferredSize(new Dimension(39, 39)); singleStepButton.setSize(new Dimension(39, 39)); singleStepButton.setToolTipText("Single Step"); singleStepButton.setIcon(singleStepIcon); ffwdButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ffwdButton_actionPerformed(e); } }); ffwdButton.setMaximumSize(new Dimension(39, 39)); ffwdButton.setMinimumSize(new Dimension(39, 39)); ffwdButton.setPreferredSize(new Dimension(39, 39)); ffwdButton.setSize(new Dimension(39, 39)); ffwdButton.setToolTipText("Fast Forward"); ffwdButton.setIcon(ffwdIcon); rewindButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { rewindButton_actionPerformed(e); } }); rewindButton.setMaximumSize(new Dimension(39, 39)); rewindButton.setMinimumSize(new Dimension(39, 39)); rewindButton.setPreferredSize(new Dimension(39, 39)); rewindButton.setSize(new Dimension(39, 39)); rewindButton.setToolTipText("Rewind"); rewindButton.setIcon(rewindIcon); stopButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopButton_actionPerformed(e); } }); stopButton.setMaximumSize(new Dimension(39, 39)); stopButton.setMinimumSize(new Dimension(39, 39)); stopButton.setPreferredSize(new Dimension(39, 39)); stopButton.setSize(new Dimension(39, 39)); stopButton.setToolTipText("Stop"); stopButton.setIcon(stopIcon); fullTranslationButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { fullTranslationButton_actionPerformed(e); } }); fullTranslationButton.setMaximumSize(new Dimension(39, 39)); fullTranslationButton.setMinimumSize(new Dimension(39, 39)); fullTranslationButton.setPreferredSize(new Dimension(39, 39)); fullTranslationButton.setSize(new Dimension(39, 39)); fullTranslationButton.setToolTipText("Fast Translation"); fullTranslationButton.setIcon(fullTranslationIcon); messageLbl.setFont(Utilities.statusLineFont); messageLbl.setLineWrap(true); messageLbl.setEditable(false); messageLbl.setCursor(null); messageLbl.setOpaque(false); messageLbl.setFocusable(false); messageLblPane.setBorder(BorderFactory.createLoweredBevelBorder()); // messageLblPane.setBounds(new Rectangle(0, 672, TRANSLATOR_WIDTH - 8, 20)); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 0; c.gridwidth = 3; c.anchor = GridBagConstraints.CENTER; c.gridx = 0; c.gridy = 2; this.getContentPane().add(messageLblPane, c); // arrowLabel.setBounds(new Rectangle(290, 324, 88, 71)); arrowLabel.setIcon(arrowIcon); // source.setVisibleRows(31); // destination.setVisibleRows(31); // source.setBounds(new Rectangle(35,100,source.getWidth(),source.getHeight())); // destination.setBounds(new Rectangle(375,100,destination.getWidth(),destination.getHeight())); c.fill = GridBagConstraints.BOTH; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = 1; c.anchor = GridBagConstraints.CENTER; c.gridx = 0; c.gridy = 1; this.getContentPane().add(source, c); c.fill = GridBagConstraints.NONE; c.ipadx = 0; c.ipady = 0; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.anchor = GridBagConstraints.CENTER; c.gridx = 1; c.gridy = 1; this.getContentPane().add(arrowLabel, c); c.fill = GridBagConstraints.BOTH; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = 1; c.anchor = GridBagConstraints.CENTER; c.gridx = 2; c.gridy = 1; this.getContentPane().add(destination, c); // Adding the tool bar to this container. toolBar.setFloatable(false); toolBar.setLocation(0, 0); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); toolBar.setBorder(BorderFactory.createEtchedBorder()); arrangeToolBar(); c.fill = GridBagConstraints.HORIZONTAL; c.ipadx = 0; c.ipady = 0; c.weightx = 1; c.weighty = 0; c.gridwidth = 3; c.anchor = GridBagConstraints.CENTER; c.gridx = 0; c.gridy = 0; this.getContentPane().add(toolBar, c); toolBar.revalidate(); toolBar.repaint(); repaint(); // Creating the menu bar arrangeMenu(); setJMenuBar(menuBar); // initializing the window size and visibility setDefaultCloseOperation(3); setSize(new Dimension(TRANSLATOR_WIDTH, TRANSLATOR_HEIGHT)); setVisible(true); }
/** initiate panel */ private void init() { txaHint = new JTextArea(); txaHint.setBorder(null); txaHint.setFocusable(false); txaHint.setLineWrap(true); txaHint.setWrapStyleWord(true); txaHint.setOpaque(false); btnHint = new JButton("Hint >>"); btnHint.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0))); txtClassDir = new JTextField(); butSelect = new JButton("Browse.."); chkBoxIncludeClass = new JCheckBox("include .class file only"); chkBoxArchiveType = new JCheckBox("Select for Service Group Archive"); setBackButtonEnabled(true); setFinishButtonEnabled(false); setPageComplete(false); this.setLayout(new GridBagLayout()); this.add( new JLabel("Class file location"), new GridBagConstraints( 0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 10, 0, 0), 0, 0)); this.add( txtClassDir, new GridBagConstraints( 1, 0, GridBagConstraints.RELATIVE, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 1, 1, 1), 0, 0)); txtClassDir.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { update(); } }); this.add( butSelect, new GridBagConstraints( 2, 0, 1, 1, 0.1, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 1, 1, 10), 0, 0)); butSelect.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = fileChooser.showOpenDialog(butSelect); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); fileChooser.setCurrentDirectory(file); txtClassDir.setText(file.getAbsolutePath()); setPageComplete(true); setNextButtonEnabled(true); } else { txtClassDir.setText(""); } update(); } }); this.add( chkBoxIncludeClass, new GridBagConstraints( 0, 1, GridBagConstraints.REMAINDER, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 1, 1), 0, 0)); chkBoxIncludeClass.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { update(); } }); // this.add(chkBoxArchiveType // , new GridBagConstraints(0, 2, GridBagConstraints.REMAINDER, 1, 0.0, 0.0 // , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL // , new Insets(5, 10, 1,1), 0, 0)); // chkBoxArchiveType .addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // update(); // } // }); this.add( btnHint, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 10, 0, 10), 0, 0)); btnHint.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (flag) { btnHint.setText("Hint >>"); txaHint.setText(""); flag = false; } else { btnHint.setText("Hint <<"); txaHint.setText(hint); flag = true; } update(); } }); this.add( txaHint, new GridBagConstraints( 0, 3, GridBagConstraints.REMAINDER, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 10, 10, 10), 0, 0)); }
/** * Sets a custom style for the given text area. * * @param textArea the text area to style */ private void setTextAreaStyle(JTextArea textArea) { textArea.setOpaque(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); }
private void jbInit() throws Exception { final JLabel textAndFont = new JLabel(Messages.getMessage("PdfViewerLabel.TextAndFont")); textAndFont.setFont(new java.awt.Font("Dialog", Font.BOLD, 14)); textAndFont.setDisplayedMnemonic('0'); textAndFont.setBounds(new Rectangle(13, 13, 220, 26)); final JLabel left = new JLabel(Messages.getMessage("PdfViewerLabel.Left")); left.setBounds(new Rectangle(130, 40, 50, 23)); final JLabel center = new JLabel(Messages.getMessage("PdfViewerLabel.Center")); center.setBounds(new Rectangle(300, 40, 50, 23)); final JLabel right = new JLabel(Messages.getMessage("PdfViewerLabel.Right")); right.setBounds(new Rectangle(475, 40, 50, 23)); final JLabel header = new JLabel(Messages.getMessage("PdfViewerLabel.Header")); header.setBounds(new Rectangle(20, 60, 90, 23)); final JLabel footer = new JLabel(Messages.getMessage("PdfViewerLabel.Footer")); footer.setBounds(new Rectangle(20, 90, 50, 23)); leftHeaderBox.setBounds(new Rectangle(85, 60, 133, 23)); centerHeaderBox.setBounds(new Rectangle(250, 60, 133, 23)); rightHeaderBox.setBounds(new Rectangle(425, 60, 133, 23)); leftFooterBox.setBounds(new Rectangle(85, 90, 133, 23)); centerFooterBox.setBounds(new Rectangle(250, 90, 133, 23)); rightFooterBox.setBounds(new Rectangle(425, 90, 133, 23)); final JLabel font = new JLabel(Messages.getMessage("PdfViewerLabel.Font")); font.setBounds(new Rectangle(20, 120, 75, 23)); fontsList.setBounds(new Rectangle(85, 120, 150, 23)); fontsList.setSelectedItem("Helvetica"); final JLabel size = new JLabel(Messages.getMessage("PdfViewerLabel.Size")); size.setBounds(new Rectangle(250, 120, 50, 23)); fontSize.setBounds(new Rectangle(290, 120, 50, 23)); final JLabel color = new JLabel(Messages.getMessage("PdfViewerLabel.Color")); color.setBounds(new Rectangle(360, 120, 50, 23)); colorBox.setBackground(Color.black); colorBox.setOpaque(true); colorBox.setBounds(new Rectangle(410, 120, 23, 23)); final JButton chooseColor = new JButton(Messages.getMessage("PdfViewerButton.ChooseColor")); chooseColor.setBounds(new Rectangle(450, 120, 160, 23)); chooseColor.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { colorBox.setBackground( JColorChooser.showDialog(null, "Color", colorBox.getBackground())); } }); tagsList.setText( "You may use the following\n" + "tags as part of the text.\n\n" + "<d> - Date in short format\n" + "<D> - Date in long format\n" + "<t> - Time in 12-hour format\n" + "<T> - Time in 24-hour format\n" + "<f> - Filename\n" + "<F> - Full path filename\n" + "<p> - Current page number\n" + "<P> - Total number of pages"); tagsList.setOpaque(false); tagsList.setBounds(350, 160, 200, 210); final JLabel margins = new JLabel(Messages.getMessage("PdfViewerLabel.Margins")); margins.setFont(new java.awt.Font("Dialog", Font.BOLD, 14)); margins.setDisplayedMnemonic('0'); margins.setBounds(new Rectangle(13, 150, 220, 26)); final JLabel leftRight = new JLabel(Messages.getMessage("PdfViewerLabel.LeftAndRight")); leftRight.setBounds(new Rectangle(20, 185, 90, 23)); leftRightBox.setBounds(new Rectangle(100, 185, 70, 23)); final JLabel topBottom = new JLabel(Messages.getMessage("PdfViewerLabel.TopAndBottom")); topBottom.setBounds(new Rectangle(180, 185, 120, 23)); topBottomBox.setBounds(new Rectangle(300, 185, 70, 23)); pageRangeLabel.setText(Messages.getMessage("PdfViewerPageRange.text")); pageRangeLabel.setBounds(new Rectangle(13, 220, 400, 26)); printAll.setText(Messages.getMessage("PdfViewerRadioButton.All")); printAll.setBounds(new Rectangle(23, 250, 75, 22)); printCurrent.setText(Messages.getMessage("PdfViewerRadioButton.CurrentPage")); printCurrent.setBounds(new Rectangle(23, 270, 100, 22)); printCurrent.setSelected(true); printPages.setText(Messages.getMessage("PdfViewerRadioButton.Pages")); printPages.setBounds(new Rectangle(23, 292, 70, 22)); pagesBox.setBounds(new Rectangle(95, 292, 230, 22)); pagesBox.addKeyListener( new KeyListener() { @Override public void keyPressed(final KeyEvent arg0) {} @Override public void keyReleased(final KeyEvent arg0) { if (pagesBox.getText().isEmpty()) { printCurrent.setSelected(true); } else { printPages.setSelected(true); } } @Override public void keyTyped(final KeyEvent arg0) {} }); final JTextArea pagesInfo = new JTextArea(Messages.getMessage("PdfViewerMessage.PageNumberOrRangeLong")); pagesInfo.setBounds(new Rectangle(23, 320, 620, 40)); pagesInfo.setOpaque(false); this.add(printAll, null); this.add(printCurrent, null); this.add(printPages, null); this.add(pagesBox, null); this.add(pagesInfo, null); this.add(left, null); this.add(center, null); this.add(right, null); this.add(header, null); this.add(footer, null); this.add(leftHeaderBox, null); this.add(centerHeaderBox, null); this.add(rightHeaderBox, null); this.add(leftFooterBox, null); this.add(centerFooterBox, null); this.add(rightFooterBox, null); this.add(font, null); this.add(fontsList, null); this.add(size, null); this.add(fontSize, null); this.add(color, null); this.add(colorBox, null); this.add(chooseColor, null); this.add(margins, null); this.add(leftRight, null); this.add(leftRightBox, null); this.add(topBottom, null); this.add(topBottomBox, null); this.add(textAndFont, null); this.add(changeButton, null); this.add(pageRangeLabel, null); // this.add(tagsList, null); this.add(jToggleButton2, null); this.add(jToggleButton3, null); buttonGroup1.add(printAll); buttonGroup1.add(printCurrent); buttonGroup1.add(printPages); }
public BaseGoogleLoginUI(@NotNull String signinText) { setLayout(new GridBagLayout()); setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT)); setOpaque(false); JLabel googleIcon = new JBLabel(); setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15)); googleIcon.setHorizontalAlignment(SwingConstants.CENTER); googleIcon.setVerticalAlignment(SwingConstants.CENTER); googleIcon.setOpaque(false); googleIcon.setIcon(GoogleLoginIcons.GOOGLE_LOGO); googleIcon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.weighty = 0; add(googleIcon, c); JTextArea signinTextArea = new JTextArea(); signinTextArea.setFont(UIUtil.getLabelFont()); signinTextArea.setLineWrap(true); signinTextArea.setWrapStyleWord(true); signinTextArea.setOpaque(false); signinTextArea.setText(signinText); c.gridx = 0; c.gridy = 1; c.weighty = 1; c.gridwidth = 2; c.weightx = 1; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; add(signinTextArea, c); }