// 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); }
// Initializes this component. private void jbInit() { fileChooser.setFileFilter(new ScriptFileFilter()); this.getContentPane().setLayout(null); Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>(); JLabel slowLabel = new JLabel("Slow"); slowLabel.setFont(Utilities.thinLabelsFont); JLabel fastLabel = new JLabel("Fast"); fastLabel.setFont(Utilities.thinLabelsFont); labelTable.put(1, slowLabel); labelTable.put(5, fastLabel); speedSlider.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { SpeedSlider_stateChanged(e); } }); speedSlider.setLabelTable(labelTable); speedSlider.setMajorTickSpacing(1); speedSlider.setPaintTicks(true); speedSlider.setPaintLabels(true); speedSlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); speedSlider.setPreferredSize(new Dimension(95, 50)); speedSlider.setMinimumSize(new Dimension(95, 50)); speedSlider.setToolTipText("Speed"); speedSlider.setMaximumSize(new Dimension(95, 50)); final Dimension buttonSize = new Dimension(39, 39); loadProgramButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { loadProgramButton_actionPerformed(); } }); loadProgramButton.setMaximumSize(buttonSize); loadProgramButton.setMinimumSize(buttonSize); loadProgramButton.setPreferredSize(buttonSize); loadProgramButton.setSize(buttonSize); loadProgramButton.setToolTipText("Load Program"); loadProgramButton.setIcon(loadProgramIcon); ffwdButton.setMaximumSize(buttonSize); ffwdButton.setMinimumSize(buttonSize); ffwdButton.setPreferredSize(buttonSize); ffwdButton.setToolTipText("Run"); ffwdButton.setIcon(ffwdIcon); ffwdButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ffwdButton_actionPerformed(); } }); stopButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopButton_actionPerformed(); } }); stopButton.setMaximumSize(buttonSize); stopButton.setMinimumSize(buttonSize); stopButton.setPreferredSize(buttonSize); stopButton.setToolTipText("Stop"); stopButton.setIcon(stopIcon); rewindButton.setMaximumSize(buttonSize); rewindButton.setMinimumSize(buttonSize); rewindButton.setPreferredSize(buttonSize); rewindButton.setToolTipText("Reset"); rewindButton.setIcon(rewindIcon); rewindButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { rewindButton_actionPerformed(); } }); scriptButton.setMaximumSize(buttonSize); scriptButton.setMinimumSize(buttonSize); scriptButton.setPreferredSize(buttonSize); scriptButton.setToolTipText("Load Script"); scriptButton.setIcon(scriptIcon); scriptButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { scriptButton_actionPerformed(); } }); breakButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { breakButton_actionPerformed(); } }); breakButton.setMaximumSize(buttonSize); breakButton.setMinimumSize(buttonSize); breakButton.setPreferredSize(buttonSize); breakButton.setToolTipText("Open breakpoint panel"); breakButton.setIcon(breakIcon); breakpointWindow.addBreakpointListener(this); singleStepButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { singleStepButton_actionPerformed(); } }); singleStepButton.setMaximumSize(buttonSize); singleStepButton.setMinimumSize(buttonSize); singleStepButton.setPreferredSize(buttonSize); singleStepButton.setSize(buttonSize); singleStepButton.setToolTipText("Single Step"); singleStepButton.setIcon(singleStepIcon); stepOverButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stepOverButton_actionPerformed(); } }); stepOverButton.setMaximumSize(buttonSize); stepOverButton.setMinimumSize(buttonSize); stepOverButton.setPreferredSize(buttonSize); stepOverButton.setSize(buttonSize); stepOverButton.setToolTipText("Step Over"); stepOverButton.setIcon(stepOverIcon); animationCombo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { animationCombo_actionPerformed(); } }); formatCombo.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { formatCombo_actionPerformed(); } }); additionalDisplayCombo.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { additionalDisplayCombo_actionPerformed(); } }); messageLbl.setFont(Utilities.statusLineFont); messageLbl.setBorder(BorderFactory.createLoweredBevelBorder()); messageLbl.setBounds(new Rectangle(0, 667, CONTROLLER_WIDTH - 8, 25)); toolBar = new JToolBar(); toolBar.setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT)); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0)); toolBar.setFloatable(false); toolBar.setLocation(0, 0); toolBar.setBorder(BorderFactory.createEtchedBorder()); arrangeToolBar(); this.getContentPane().add(toolBar, null); toolBar.revalidate(); toolBar.repaint(); repaint(); // Creating the menu bar menuBar = new JMenuBar(); arrangeMenu(); setJMenuBar(menuBar); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.getContentPane().add(messageLbl, null); setControllerSize(); // sets the frame to be visible. setVisible(true); }
/** * Customization of external program paths. * * @param prefs a <code>JabRefPreferences</code> value */ public TableColumnsTab(JabRefPreferences prefs, JabRefFrame frame) { _prefs = prefs; this.frame = frame; setLayout(new BorderLayout()); TableModel tm = new AbstractTableModel() { public int getRowCount() { return rowCount; } public int getColumnCount() { return 2; } public Object getValueAt(int row, int column) { if (row == 0) return (column == 0 ? GUIGlobals.NUMBER_COL : "" + ncWidth); row--; if (row >= tableRows.size()) return ""; Object rowContent = tableRows.elementAt(row); if (rowContent == null) return ""; TableRow tr = (TableRow) rowContent; switch (column) { case 0: return tr.name; case 1: return ((tr.length > 0) ? Integer.toString(tr.length) : ""); } return null; // Unreachable. } public String getColumnName(int col) { return (col == 0 ? Globals.lang("Field name") : Globals.lang("Column width")); } public Class<?> getColumnClass(int column) { if (column == 0) return String.class; else return Integer.class; } public boolean isCellEditable(int row, int col) { return !((row == 0) && (col == 0)); } public void setValueAt(Object value, int row, int col) { tableChanged = true; // Make sure the vector is long enough. while (row >= tableRows.size()) tableRows.add(new TableRow("", -1)); if ((row == 0) && (col == 1)) { ncWidth = Integer.parseInt(value.toString()); return; } TableRow rowContent = tableRows.elementAt(row - 1); if (col == 0) { rowContent.name = value.toString(); if (((String) getValueAt(row, 1)).equals("")) setValueAt("" + GUIGlobals.DEFAULT_FIELD_LENGTH, row, 1); } else { if (value == null) rowContent.length = -1; else rowContent.length = Integer.parseInt(value.toString()); } } }; colSetup = new JTable(tm); TableColumnModel cm = colSetup.getColumnModel(); cm.getColumn(0).setPreferredWidth(140); cm.getColumn(1).setPreferredWidth(80); FormLayout layout = new FormLayout( "1dlu, 8dlu, left:pref, 4dlu, fill:pref", // , 4dlu, fill:60dlu, 4dlu, fill:pref", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); JPanel pan = new JPanel(); JPanel tabPanel = new JPanel(); tabPanel.setLayout(new BorderLayout()); JScrollPane sp = new JScrollPane( colSetup, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); colSetup.setPreferredScrollableViewportSize(new Dimension(250, 200)); sp.setMinimumSize(new Dimension(250, 300)); tabPanel.add(sp, BorderLayout.CENTER); JToolBar tlb = new JToolBar(SwingConstants.VERTICAL); tlb.setFloatable(false); // tlb.setRollover(true); // tlb.setLayout(gbl); AddRowAction ara = new AddRowAction(); DeleteRowAction dra = new DeleteRowAction(); MoveRowUpAction moveUp = new MoveRowUpAction(); MoveRowDownAction moveDown = new MoveRowDownAction(); tlb.setBorder(null); tlb.add(ara); tlb.add(dra); tlb.addSeparator(); tlb.add(moveUp); tlb.add(moveDown); // tlb.addSeparator(); // tlb.add(new UpdateWidthsAction()); tabPanel.add(tlb, BorderLayout.EAST); showOneLetterHeadingForIconColumns = new JCheckBox(Globals.lang("Show one letter heading for icon columns")); fileColumn = new JCheckBox(Globals.lang("Show file column")); pdfColumn = new JCheckBox(Globals.lang("Show PDF/PS column")); urlColumn = new JCheckBox(Globals.lang("Show URL/DOI column")); preferUrl = new JRadioButton(Globals.lang("Show URL first")); preferDoi = new JRadioButton(Globals.lang("Show DOI first")); preferUrlDoiGroup = new ButtonGroup(); preferUrlDoiGroup.add(preferUrl); preferUrlDoiGroup.add(preferDoi); urlColumn.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { preferUrl.setEnabled(urlColumn.isSelected()); preferDoi.setEnabled(urlColumn.isSelected()); } }); arxivColumn = new JCheckBox(Globals.lang("Show ArXiv column")); /** * begin: special table columns and special fields ** */ HelpAction help = new HelpAction(frame.helpDiag, GUIGlobals.specialFieldsHelp); hlb = new JButton(GUIGlobals.getImage("helpSmall")); hlb.setToolTipText(Globals.lang("Help on special fields")); hlb.addActionListener(help); specialFieldsEnabled = new JCheckBox(Globals.lang("Enable special fields")); // .concat(". ").concat(Globals.lang("You must restart JabRef for this to come into // effect."))); specialFieldsEnabled.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent event) { boolean isEnabled = specialFieldsEnabled.isSelected(); rankingColumn.setEnabled(isEnabled); compactRankingColumn.setEnabled(isEnabled ? rankingColumn.isSelected() : false); qualityColumn.setEnabled(isEnabled); priorityColumn.setEnabled(isEnabled); relevanceColumn.setEnabled(isEnabled); syncKeywords.setEnabled(isEnabled); writeSpecialFields.setEnabled(isEnabled); } }); rankingColumn = new JCheckBox(Globals.lang("Show rank")); rankingColumn.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent event) { compactRankingColumn.setEnabled(rankingColumn.isSelected()); } }); compactRankingColumn = new JCheckBox(Globals.lang("Compact rank")); qualityColumn = new JCheckBox(Globals.lang("Show quality")); priorityColumn = new JCheckBox(Globals.lang("Show priority")); relevanceColumn = new JCheckBox(Globals.lang("Show relevance")); // "sync keywords" and "write special" fields may be configured mutually exclusive only // The implementation supports all combinations (TRUE+TRUE and FALSE+FALSE, even if the latter // does not make sense) // To avoid confusion, we opted to make the setting mutually exclusive syncKeywords = new JRadioButton(Globals.lang("Synchronize with keywords")); writeSpecialFields = new JRadioButton( Globals.lang("Write values of special fields as separate fields to BibTeX")); ButtonGroup group = new ButtonGroup(); group.add(syncKeywords); group.add(writeSpecialFields); builder.appendSeparator(Globals.lang("Special table columns")); builder.nextLine(); builder.append(pan); DefaultFormBuilder specialTableColumnsBuilder = new DefaultFormBuilder( new FormLayout( "8dlu, 8dlu, 8cm, 8dlu, 8dlu, left:pref:grow", "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref")); CellConstraints cc = new CellConstraints(); specialTableColumnsBuilder.add(specialFieldsEnabled, cc.xyw(1, 1, 3)); specialTableColumnsBuilder.add(rankingColumn, cc.xyw(2, 2, 2)); specialTableColumnsBuilder.add(compactRankingColumn, cc.xy(3, 3)); specialTableColumnsBuilder.add(relevanceColumn, cc.xyw(2, 4, 2)); specialTableColumnsBuilder.add(qualityColumn, cc.xyw(2, 5, 2)); specialTableColumnsBuilder.add(priorityColumn, cc.xyw(2, 6, 2)); specialTableColumnsBuilder.add(syncKeywords, cc.xyw(2, 7, 2)); specialTableColumnsBuilder.add(writeSpecialFields, cc.xyw(2, 8, 2)); specialTableColumnsBuilder.add(showOneLetterHeadingForIconColumns, cc.xyw(1, 9, 5)); specialTableColumnsBuilder.add(hlb, cc.xyw(1, 10, 2)); specialTableColumnsBuilder.add(fileColumn, cc.xyw(5, 1, 2)); specialTableColumnsBuilder.add(pdfColumn, cc.xyw(5, 2, 2)); specialTableColumnsBuilder.add(urlColumn, cc.xyw(5, 3, 2)); specialTableColumnsBuilder.add(preferUrl, cc.xy(6, 4)); specialTableColumnsBuilder.add(preferDoi, cc.xy(6, 5)); specialTableColumnsBuilder.add(arxivColumn, cc.xyw(5, 6, 2)); builder.append(specialTableColumnsBuilder.getPanel()); builder.nextLine(); /** * end: special table columns and special fields ** */ builder.appendSeparator(Globals.lang("Entry table columns")); builder.nextLine(); builder.append(pan); builder.append(tabPanel); builder.nextLine(); // lab = new JLabel("<HTML>("+Globals.lang("this button will update the column width // settings<BR>" // +"to match the current widths in your table")+")</HTML>"); // lab = new JLabel("<HTML>("+Globals.lang("this_button_will_update") +")</HTML>") ; builder.append(pan); JButton buttonWidth = new JButton(new UpdateWidthsAction()); JButton buttonOrder = new JButton(new UpdateOrderAction()); builder.append(buttonWidth); builder.nextLine(); builder.append(pan); builder.append(buttonOrder); builder.nextLine(); builder.append(pan); // builder.append(lab); builder.nextLine(); pan = builder.getPanel(); pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(pan, BorderLayout.CENTER); }