Author: pwang
Date: 2011-03-28 16:40:52 -0700 (Mon, 28 Mar 2011)
New Revision: 24602
Modified:
core3/work-swing-api/trunk/src/main/java/org/cytoscape/work/swing/TunnableDialog.java
Log:
Add offset for the preferredSize of added component
Modified:
core3/work-swing-api/trunk/src/main/java/org/cytoscape/work/swing/TunnableDialog.java
===================================================================
---
core3/work-swing-api/trunk/src/main/java/org/cytoscape/work/swing/TunnableDialog.java
2011-03-28 23:34:06 UTC (rev 24601)
+++
core3/work-swing-api/trunk/src/main/java/org/cytoscape/work/swing/TunnableDialog.java
2011-03-28 23:40:52 UTC (rev 24602)
@@ -3,6 +3,7 @@
import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.Component;
+import java.awt.Dimension;
public class TunnableDialog extends JDialog {
@@ -16,8 +17,15 @@
//
public void addComponent(Component optionPanel){
+
+ // adjust the preferred size of optionPanel
+ int w = optionPanel.getPreferredSize().width+30;
+ int h = optionPanel.getPreferredSize().height+30;
+ optionPanel.setPreferredSize(new Dimension(w, h));
+
jScrollPane1.setViewportView(optionPanel);
- pack();
+
+ pack();
}
// Set the text to replace the "OK" string on OK button
@@ -67,7 +75,7 @@
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
- gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.