Revision: 2633
http://sourceforge.net/p/swingme/code/2633
Author: yuranet
Date: 2022-01-04 21:32:06 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
fix for long button text
Modified Paths:
--------------
SwingME/src/net/yura/mobile/gui/components/OptionPane.java
Modified: SwingME/src/net/yura/mobile/gui/components/OptionPane.java
===================================================================
--- SwingME/src/net/yura/mobile/gui/components/OptionPane.java 2022-01-01 17:27:10 UTC (rev 2632)
+++ SwingME/src/net/yura/mobile/gui/components/OptionPane.java 2022-01-04 21:32:06 UTC (rev 2633)
@@ -143,8 +143,8 @@
scroll = new ScrollPane(c);
panel.add( scroll );
- cmdPanel = new Panel( new FlowLayout() );
- panel.add( cmdPanel ,Graphics.BOTTOM);
+ cmdPanel = new Panel();
+ panel.add(cmdPanel, Graphics.BOTTOM);
}
private ActionListener actionListener;
@@ -202,7 +202,6 @@
else {
content.add(getComponentFromObject(newMessage),constraints);
}
-
}
/**
@@ -308,6 +307,8 @@
*/
public void setOptions(Button[] options) {
cmdPanel.removeAll();
+ cmdPanel.setLayout(new FlowLayout());
+
for (int c=0;c<options.length;c++) {
Button button = options[c];
ActionListener[] actionListeners = button.getActionListeners();
@@ -322,6 +323,12 @@
// this should be removed one day
autoMnemonic( cmdPanel.getComponents() );
}
+
+ // check all the buttons fit on the screen, if no, make then arrange vertically
+ cmdPanel.workoutMinimumSize();
+ if (cmdPanel.getWidth() > getDesktopPane().getWidth()) {
+ cmdPanel.setLayout(new BoxLayout(Graphics.VCENTER));
+ }
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|