[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl Editor.java, 1.4, 1.5
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-20 14:56:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3817/src/net/sourceforge/bprocessor/gl Modified Files: Editor.java Log Message: refactored statusbar Index: Editor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/Editor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Editor.java 19 Nov 2007 17:57:32 -0000 1.4 --- Editor.java 20 Nov 2007 14:56:46 -0000 1.5 *************** *** 18,21 **** --- 18,22 ---- import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.gui.PreviewPanel; + import net.sourceforge.bprocessor.gui.StatusBar; import java.awt.Color; *************** *** 23,27 **** import java.awt.Dimension; import java.awt.BorderLayout; - import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; --- 24,27 ---- *************** *** 34,41 **** import javax.media.opengl.GLException; ! ! import javax.swing.BorderFactory; import javax.swing.JColorChooser; import javax.swing.JComboBox; import javax.swing.JSeparator; import javax.swing.JTextField; --- 34,41 ---- import javax.media.opengl.GLException; ! import javax.swing.Box; import javax.swing.JColorChooser; import javax.swing.JComboBox; + import javax.swing.JComponent; import javax.swing.JSeparator; import javax.swing.JTextField; *************** *** 45,48 **** --- 45,49 ---- import javax.swing.JMenuItem; import javax.swing.JPopupMenu; + import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; *************** *** 71,85 **** /** The label and combobox for the reality factor */ private FactorBox factor; ! ! private JPanel lengthPanel; private JLabel tipLabel; ! private JPanel tipPanel; ! private JPanel bottomPanel; - private JPanel jp; /** * Constuctor --- 72,142 ---- /** The label and combobox for the reality factor */ private FactorBox factor; ! ! private Box factorPanel; private JLabel tipLabel; ! private JPanel jp; ! private JComponent createSeparator(int height) { ! JSeparator separator = new JSeparator(SwingConstants.VERTICAL); ! separator.setMaximumSize(new Dimension(2, height)); ! return separator; ! } ! ! private JComponent createTipPanel() { ! Box tippanel = Box.createVerticalBox(); ! tippanel.add(Box.createRigidArea(new Dimension(360, 0))); ! Box labelarea = Box.createHorizontalBox(); ! tipLabel = new JLabel("Tip"); ! labelarea.add(tipLabel); ! labelarea.add(Box.createHorizontalGlue()); ! tippanel.add(labelarea); ! return tippanel; ! } ! ! private JComponent createLengthPanel() { ! Box lengthpanel = Box.createVerticalBox(); ! lengthpanel.add(Box.createRigidArea(new Dimension(180, 0))); ! Box lengtharea = Box.createHorizontalBox(); ! lengtharea.add(Box.createHorizontalGlue()); ! lengtharea.add(new JLabel("Length:")); ! lengtharea.add(Box.createHorizontalStrut(3)); ! lengthField = new LengthField(); ! Dimension preferred = lengthField.getPreferredSize(); ! lengthField.setMaximumSize(preferred); ! lengtharea.add(lengthField); ! lengthpanel.add(lengtharea); ! return lengthpanel; ! } ! ! private JComponent createScalePanel() { ! Box panel = Box.createVerticalBox(); ! panel.add(Box.createRigidArea(new Dimension(200, 0))); ! Box labelarea = Box.createHorizontalBox(); ! factorPanel = Box.createHorizontalBox(); ! labelarea.add(factorPanel); ! labelarea.add(Box.createHorizontalGlue()); ! panel.add(labelarea); ! panel.setMaximumSize(new Dimension(200, 32)); ! return panel; ! } + private void createStatusBar() { + Box content = StatusBar.instance().content(); + content.add(createTipPanel()); + content.add(Box.createHorizontalGlue()); + content.add(Box.createHorizontalStrut(7)); + content.add(createSeparator(18)); + content.add(Box.createHorizontalStrut(7)); + content.add(createLengthPanel()); + content.add(Box.createHorizontalStrut(7)); + content.add(createSeparator(18)); + content.add(Box.createHorizontalStrut(7)); + content.add(createScalePanel()); + content.add(Box.createHorizontalStrut(20)); + } + /** * Constuctor *************** *** 111,146 **** } ! GUI.getInstance().incrementPB(); ! ! { ! lengthPanel = new JPanel(); ! lengthPanel.setLayout(new BorderLayout()); ! lengthPanel.add(new JLabel("Length: "), BorderLayout.WEST); ! lengthField = new LengthField(); ! lengthPanel.add(lengthField, BorderLayout.CENTER); ! } factor = new FactorBox(); ! { ! tipPanel = new JPanel(); ! tipPanel.setLayout(new BorderLayout()); ! tipPanel.add(new JLabel("Tip: "), BorderLayout.WEST); ! tipLabel = new JLabel("Hello World!"); ! Font basicFont = tipLabel.getFont(); ! tipLabel.setFont(new Font(basicFont.getName(), Font.PLAIN, basicFont.getSize())); ! tipPanel.add(tipLabel, BorderLayout.CENTER); ! } ! ! { ! bottomPanel = new JPanel(); ! bottomPanel.setLayout(new BorderLayout()); ! bottomPanel.setBorder(BorderFactory.createEtchedBorder()); ! bottomPanel.add(lengthPanel, BorderLayout.NORTH); ! bottomPanel.add(new JSeparator(), BorderLayout.CENTER); ! bottomPanel.add(tipPanel, BorderLayout.SOUTH); ! } ! ! jp.add(bottomPanel, BorderLayout.SOUTH); GUI.getInstance().incrementPB(); --- 168,177 ---- } ! GUI.getInstance().incrementPB(); factor = new FactorBox(); + factor.setMaximumSize(factor.getPreferredSize()); ! createStatusBar(); GUI.getInstance().incrementPB(); *************** *** 386,391 **** */ public void disableFactor() { ! lengthPanel.remove(factor); ! lengthPanel.revalidate(); } --- 417,424 ---- */ public void disableFactor() { ! factorPanel.remove(factor); ! StatusBar.instance().content().revalidate(); ! // lengthPanel.remove(factor); ! // lengthPanel.revalidate(); } *************** *** 394,399 **** */ public void enableFactor() { ! lengthPanel.add(factor, BorderLayout.EAST); ! lengthPanel.revalidate(); } --- 427,434 ---- */ public void enableFactor() { ! factorPanel.add(factor); ! StatusBar.instance().content().revalidate(); ! // lengthPanel.add(factor, BorderLayout.EAST); ! // lengthPanel.revalidate(); } *************** *** 423,427 **** public FactorBox() { super(); ! label = new JLabel("Scale factor:"); this.add(label); items = new String[]{"1:1", "1:2", "1:5", "1:10", "1:20", "1:50", --- 458,462 ---- public FactorBox() { super(); ! label = new JLabel("Scale:"); this.add(label); items = new String[]{"1:1", "1:2", "1:5", "1:10", "1:20", "1:50", *************** *** 468,472 **** */ public LengthField() { ! super(15); } --- 503,507 ---- */ public LengthField() { ! super(7); } |