Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9817/src/net/sourceforge/bprocessor/gl
Modified Files:
GLView.java
Log Message:
minor changes to factor choser
Index: GLView.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** GLView.java 14 Jan 2007 23:33:28 -0000 1.48
--- GLView.java 19 Jan 2007 14:18:32 -0000 1.49
***************
*** 62,65 ****
--- 62,67 ----
private FactorBox factor;
+ private JPanel lengthPanel;
+
/**
* Constuctor
***************
*** 83,87 ****
GUI.getInstance().incrementPB();
! JPanel lengthPanel = new JPanel();
lengthPanel.setLayout(new BorderLayout());
lengthPanel.add(new JLabel("Length: "), BorderLayout.WEST);
--- 85,89 ----
GUI.getInstance().incrementPB();
! lengthPanel = new JPanel();
lengthPanel.setLayout(new BorderLayout());
lengthPanel.add(new JLabel("Length: "), BorderLayout.WEST);
***************
*** 89,98 ****
lengthPanel.add(lengthField, BorderLayout.CENTER);
factor = new FactorBox();
! disableFactor();
! lengthPanel.add(factor, BorderLayout.EAST);
!
jp.add(lengthPanel, BorderLayout.SOUTH);
GUI.getInstance().incrementPB();
!
tool = ToolFactory.getFactory(this).getDefault();
--- 91,99 ----
lengthPanel.add(lengthField, BorderLayout.CENTER);
factor = new FactorBox();
! //lengthPanel.add(factor, BorderLayout.EAST);
! GUI.getInstance().incrementPB();
jp.add(lengthPanel, BorderLayout.SOUTH);
GUI.getInstance().incrementPB();
!
tool = ToolFactory.getFactory(this).getDefault();
***************
*** 274,278 ****
*/
public void disableFactor() {
! factor.disable();
}
--- 275,280 ----
*/
public void disableFactor() {
! lengthPanel.remove(factor);
! lengthPanel.revalidate();
}
***************
*** 281,285 ****
*/
public void enableFactor() {
! factor.enable();
}
--- 283,288 ----
*/
public void enableFactor() {
! lengthPanel.add(factor, BorderLayout.EAST);
! lengthPanel.revalidate();
}
***************
*** 309,315 ****
public FactorBox() {
super();
! label = new JLabel("Factor:");
this.add(label);
! items = new String[]{"1:1", "1:50", "1:100", "1:500", "1:1000"};
choices = new JComboBox(items);
choices.setEditable(true);
--- 312,318 ----
public FactorBox() {
super();
! label = new JLabel("Scale factor:");
this.add(label);
! items = new String[]{"1:1", "1:2","1:5", "1:10", "1:50", "1:100", "1:500", "1:1000"};
choices = new JComboBox(items);
choices.setEditable(true);
***************
*** 324,371 ****
public void setFactor(int i) {
String item = "1:" + i;
- //Uncomment if the element should be inserted into menu
- /*int where = contains(item);
- if (where != -1) {
- choices.insertItemAt(item, where);
- }*/
choices.setSelectedItem(item);
}
-
- /**
- * Check if the item is allready there or it should be addded
- * @param item The item to check for
- * @return The position to add the element if it's not there otherwise -1
- */
- private int contains(String item) {
- int val = choices.getItemCount();
- int itemval = Integer.parseInt(item.substring(2));
- for (int i = 0; i < choices.getItemCount(); i++) {
- int cur = Integer.parseInt(((String)choices.getItemAt(i)).substring(2));
- if (itemval == cur) {
- return -1;
- } else if (itemval > cur) {
- val = i + 1;
- } else {
- return val;
- }
- }
- return val;
- }
-
- /**
- * Enable the box
- */
- public void disable() {
- label.setEnabled(false);
- choices.setEnabled(false);
- }
-
- /**
- * Disable the box
- */
- public void enable() {
- label.setEnabled(true);
- choices.setEnabled(true);
- }
/**
--- 327,332 ----
|