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); }
/** * 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); }