X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGFontChooser.java;h=3352e42d6d98d2efcc86ab449fb67e04f51392e9;hb=a45774ee31d9f35d4eff46d54d7deab719afb092;hp=d49cc870b2e464632f73c9a0efebabdb69ea3913;hpb=a73042dd5f38ed512744fa7ee5db99270dfcf3be;p=jalview.git diff --git a/src/jalview/jbgui/GFontChooser.java b/src/jalview/jbgui/GFontChooser.java index d49cc87..3352e42 100755 --- a/src/jalview/jbgui/GFontChooser.java +++ b/src/jalview/jbgui/GFontChooser.java @@ -1,46 +1,101 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.jbgui; -import javax.swing.*; +import jalview.gui.JvSwingUtils; + import java.awt.*; import java.awt.event.*; +import javax.swing.*; - +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ public class GFontChooser extends JPanel { JLabel jLabel1 = new JLabel(); + protected JComboBox fontSize = new JComboBox(); + protected JComboBox fontStyle = new JComboBox(); + JLabel jLabel2 = new JLabel(); + JLabel jLabel3 = new JLabel(); + protected JComboBox fontName = new JComboBox(); + JButton ok = new JButton(); + JButton cancel = new JButton(); + JPanel jPanel1 = new JPanel(); + JPanel jPanel2 = new JPanel(); + JPanel jPanel3 = new JPanel(); + BorderLayout borderLayout1 = new BorderLayout(); + BorderLayout borderLayout2 = new BorderLayout(); + BorderLayout borderLayout3 = new BorderLayout(); - FlowLayout flowLayout1 = new FlowLayout(); + protected JButton defaultButton = new JButton(); + + protected JCheckBox smoothFont = new JCheckBox(); + + BorderLayout borderLayout4 = new BorderLayout(); + + protected JCheckBox monospaced = new JCheckBox(); + + JPanel jPanel4 = new JPanel(); + + /** + * Creates a new GFontChooser object. + */ public GFontChooser() { try { jbInit(); - } - catch(Exception e) + } catch (Exception e) { e.printStackTrace(); } } + + /** + * DOCUMENT ME! + * + * @throws Exception + * DOCUMENT ME! + */ private void jbInit() throws Exception { jLabel1.setFont(new java.awt.Font("Verdana", 0, 11)); jLabel1.setHorizontalAlignment(SwingConstants.RIGHT); jLabel1.setText("Font: "); jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER); - this.setLayout(flowLayout1); + this.setLayout(null); fontSize.setFont(new java.awt.Font("Verdana", 0, 11)); fontSize.setOpaque(false); fontSize.setPreferredSize(new Dimension(50, 21)); @@ -101,48 +156,120 @@ public class GFontChooser extends JPanel }); this.setBackground(Color.white); jPanel1.setOpaque(false); + jPanel1.setBounds(new Rectangle(5, 6, 308, 23)); jPanel1.setLayout(borderLayout1); jPanel2.setOpaque(false); + jPanel2.setBounds(new Rectangle(5, 37, 128, 21)); jPanel2.setLayout(borderLayout3); jPanel3.setOpaque(false); + jPanel3.setBounds(new Rectangle(174, 38, 134, 21)); jPanel3.setLayout(borderLayout2); - flowLayout1.setAlignment(FlowLayout.CENTER); - flowLayout1.setVgap(10); - this.add(jPanel1, null); + defaultButton.setFont(JvSwingUtils.getLabelFont()); + defaultButton.setText("Set as Default"); + defaultButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + defaultButton_actionPerformed(e); + } + }); + smoothFont.setFont(JvSwingUtils.getLabelFont()); + smoothFont.setOpaque(false); + smoothFont.setText("Anti-alias Fonts (Slower to render)"); + smoothFont.setBounds(new Rectangle(41, 65, 223, 23)); + smoothFont.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + smoothFont_actionPerformed(e); + } + }); + monospaced.setEnabled(false); + monospaced.setFont(JvSwingUtils.getLabelFont()); + monospaced.setOpaque(false); + monospaced.setToolTipText("Monospaced fonts are faster to render"); + monospaced.setText("Monospaced"); + jPanel4.setOpaque(false); + jPanel4.setBounds(new Rectangle(24, 92, 259, 35)); jPanel1.add(jLabel1, BorderLayout.WEST); jPanel1.add(fontName, BorderLayout.CENTER); + jPanel1.add(monospaced, java.awt.BorderLayout.EAST); this.add(jPanel3, null); this.add(jPanel2, null); - jPanel2.add(jLabel3, BorderLayout.WEST); - jPanel2.add(fontStyle, BorderLayout.CENTER); - jPanel3.add(jLabel2, BorderLayout.WEST); - jPanel3.add(fontSize, BorderLayout.CENTER); - this.add(ok, null); - this.add(cancel, null); + jPanel2.add(fontSize, java.awt.BorderLayout.CENTER); + jPanel2.add(jLabel2, java.awt.BorderLayout.WEST); + jPanel4.add(defaultButton); + jPanel4.add(ok); + jPanel4.add(cancel); + this.add(smoothFont); + this.add(jPanel4); + jPanel3.add(jLabel3, java.awt.BorderLayout.WEST); + jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER); + this.add(jPanel1, null); } + /** + * DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ protected void ok_actionPerformed(ActionEvent e) { - } + /** + * DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ protected void cancel_actionPerformed(ActionEvent e) { - } + /** + * DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ protected void fontName_actionPerformed(ActionEvent e) { - } + /** + * DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ protected void fontSize_actionPerformed(ActionEvent e) { - } + /** + * DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ protected void fontStyle_actionPerformed(ActionEvent e) { + } + + /** + * DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ + public void defaultButton_actionPerformed(ActionEvent e) + { + } + + public void smoothFont_actionPerformed(ActionEvent e) + { } }