X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGFontChooser.java;h=5c15e802fc5c5ec1baf7b2e01c9bc138a72ee11f;hb=a7169b1c72607f3c9357195b4999869650a2a891;hp=87506efb833cdb00dcb529067041625f8565d64a;hpb=d423f22792e47dbc800ae220a58677f988971d06;p=jalview.git
diff --git a/src/jalview/jbgui/GFontChooser.java b/src/jalview/jbgui/GFontChooser.java
index 87506ef..5c15e80 100755
--- a/src/jalview/jbgui/GFontChooser.java
+++ b/src/jalview/jbgui/GFontChooser.java
@@ -1,25 +1,42 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* 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.
- *
+ * 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
+import jalview.gui.JvSwingUtils;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
/**
* DOCUMENT ME!
@@ -29,43 +46,24 @@ import javax.swing.*;
*/
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();
+ private static final Font VERDANA_11PT = new java.awt.Font("Verdana", 0,
+ 11);
- JPanel jPanel3 = new JPanel();
+ protected JComboBox fontSize = new JComboBox();
- BorderLayout borderLayout1 = new BorderLayout();
+ protected JComboBox fontStyle = new JComboBox();
- BorderLayout borderLayout2 = new BorderLayout();
-
- BorderLayout borderLayout3 = new BorderLayout();
+ protected JComboBox fontName = new JComboBox();
protected JButton defaultButton = new JButton();
protected JCheckBox smoothFont = new JCheckBox();
- BorderLayout borderLayout4 = new BorderLayout();
-
protected JCheckBox monospaced = new JCheckBox();
- JPanel jPanel4 = new JPanel();
+ protected JCheckBox scaleAsCdna = new JCheckBox();
+
+ protected JCheckBox fontAsCdna = new JCheckBox();
/**
* Creates a new GFontChooser object.
@@ -89,185 +87,232 @@ public class GFontChooser extends JPanel
*/
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(null);
- fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
+ this.setBackground(Color.white);
+
+ JLabel fontLabel = new JLabel(MessageManager.getString("label.font"));
+ fontLabel.setFont(VERDANA_11PT);
+ fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ fontLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+
+ fontSize.setFont(VERDANA_11PT);
fontSize.setOpaque(false);
fontSize.setPreferredSize(new Dimension(50, 21));
fontSize.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- fontSize_actionPerformed(e);
+ fontSize_actionPerformed();
}
});
- fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
+
+ fontStyle.setFont(VERDANA_11PT);
fontStyle.setOpaque(false);
fontStyle.setPreferredSize(new Dimension(90, 21));
fontStyle.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- fontStyle_actionPerformed(e);
+ fontStyle_actionPerformed();
}
});
- jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
- jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
- jLabel2.setText("Size: ");
- jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
- jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
- jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
- jLabel3.setText("Style: ");
- jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
- fontName.setFont(new java.awt.Font("Verdana", 0, 11));
+
+ JLabel sizeLabel = new JLabel(MessageManager.getString("label.size"));
+ sizeLabel.setFont(VERDANA_11PT);
+ sizeLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ sizeLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+
+ JLabel styleLabel = new JLabel(MessageManager.getString("label.style"));
+ styleLabel.setFont(VERDANA_11PT);
+ styleLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ styleLabel.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
+
+ fontName.setFont(VERDANA_11PT);
fontName.setMaximumSize(new Dimension(32767, 32767));
fontName.setMinimumSize(new Dimension(300, 21));
fontName.setOpaque(false);
fontName.setPreferredSize(new Dimension(180, 21));
fontName.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- fontName_actionPerformed(e);
+ fontName_actionPerformed();
}
});
- ok.setFont(new java.awt.Font("Verdana", 0, 11));
- ok.setText("OK");
+
+ JButton ok = new JButton(MessageManager.getString("action.ok"));
+ ok.setFont(VERDANA_11PT);
ok.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- ok_actionPerformed(e);
+ ok_actionPerformed();
}
});
- cancel.setFont(new java.awt.Font("Verdana", 0, 11));
- cancel.setText("Cancel");
+
+ JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+ cancel.setFont(VERDANA_11PT);
cancel.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- cancel_actionPerformed(e);
+ cancel_actionPerformed();
}
});
- 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);
- defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
- defaultButton.setText("Set as Default");
+
+ defaultButton.setFont(JvSwingUtils.getLabelFont());
+ defaultButton.setText(MessageManager.getString("label.set_as_default"));
defaultButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- defaultButton_actionPerformed(e);
+ defaultButton_actionPerformed();
}
});
- smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+
+ smoothFont.setFont(JvSwingUtils.getLabelFont());
smoothFont.setOpaque(false);
- smoothFont.setText("Anti-alias Fonts (Slower to render)");
- smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
+ smoothFont.setText(MessageManager.getString("label.anti_alias_fonts"));
+ smoothFont.setBounds(new Rectangle(1, 65, 300, 23));
smoothFont.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- smoothFont_actionPerformed(e);
+ smoothFont_actionPerformed();
}
});
+
+ /*
+ * Scale protein as cDNA is only visible in SplitFrame
+ */
+ scaleAsCdna.setVisible(false);
+ scaleAsCdna.setFont(JvSwingUtils.getLabelFont());
+ scaleAsCdna.setOpaque(false);
+ scaleAsCdna.setText(MessageManager.getString("label.scale_as_cdna"));
+ scaleAsCdna.setBounds(new Rectangle(1, 85, 300, 23));
+ scaleAsCdna.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ scaleAsCdna_actionPerformed();
+ }
+ });
+
+ /*
+ * Same font for cDNA/peptide is only visible in SplitFrame
+ */
+ fontAsCdna.setVisible(false);
+ fontAsCdna.setFont(JvSwingUtils.getLabelFont());
+ fontAsCdna.setOpaque(false);
+ fontAsCdna.setText(MessageManager.getString("label.font_as_cdna"));
+ fontAsCdna.setBounds(new Rectangle(1, 105, 350, 23));
+ fontAsCdna.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ mirrorFonts_actionPerformed();
+ }
+ });
+
monospaced.setEnabled(false);
- monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
+ 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);
+ monospaced.setToolTipText(MessageManager
+ .getString("label.monospaced_fonts_faster_to_render"));
+ monospaced.setText(MessageManager.getString("label.monospaced_font"));
+
+ /*
+ * jPanel1: Font dropdown, Monospaced checkbox
+ */
+ JPanel jPanel1 = new JPanel();
+ jPanel1.setOpaque(false);
+ jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
+ jPanel1.setLayout(new BorderLayout());
+ jPanel1.add(fontLabel, BorderLayout.WEST);
jPanel1.add(fontName, BorderLayout.CENTER);
jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
- this.add(jPanel3, null);
- this.add(jPanel2, null);
+
+ /*
+ * jPanel2: font size dropdown
+ */
+ JPanel jPanel2 = new JPanel();
+ jPanel2.setOpaque(false);
+ jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
+ jPanel2.setLayout(new BorderLayout());
jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
- jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
+ jPanel2.add(sizeLabel, java.awt.BorderLayout.WEST);
+
+ /*
+ * jPanel3: font style dropdown
+ */
+ JPanel jPanel3 = new JPanel();
+ jPanel3.setOpaque(false);
+ jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
+ jPanel3.setLayout(new BorderLayout());
+ jPanel3.add(styleLabel, java.awt.BorderLayout.WEST);
+ jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
+
+ /*
+ * jPanel4: Default and OK buttons
+ */
+ JPanel jPanel4 = new JPanel();
+ jPanel4.setOpaque(false);
+ jPanel4.setBounds(new Rectangle(24, 132, 300, 35));
jPanel4.add(defaultButton);
jPanel4.add(ok);
jPanel4.add(cancel);
+
this.add(smoothFont);
+ this.add(scaleAsCdna);
+ this.add(fontAsCdna);
+ this.add(jPanel3, null);
+ this.add(jPanel2, null);
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)
+ protected void mirrorFonts_actionPerformed()
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void cancel_actionPerformed(ActionEvent e)
+ protected void scaleAsCdna_actionPerformed()
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void fontName_actionPerformed(ActionEvent e)
+ protected void ok_actionPerformed()
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void fontSize_actionPerformed(ActionEvent e)
+ protected void cancel_actionPerformed()
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void fontStyle_actionPerformed(ActionEvent e)
+ protected void fontName_actionPerformed()
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- public void defaultButton_actionPerformed(ActionEvent e)
+ protected void fontSize_actionPerformed()
{
}
- public void smoothFont_actionPerformed(ActionEvent e)
+ protected void fontStyle_actionPerformed()
{
+ }
+ public void defaultButton_actionPerformed()
+ {
+ }
+
+ protected void smoothFont_actionPerformed()
+ {
}
}