Results 1 to 9 of 9
- 01-23-2011, 02:12 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 6
- Rep Power
- 0
The dialog initiates with height=0 and width=0
Hello everyone!
I'm developing some software for my final degree (i'm not an informatic...)
well the thing is that I am continuing the software of another guy, and I found the connect dialog quite unusable, thats why I deleted it and started another with the same name and basic functions from scratch (maybe a bad idea...)
the thing is that the main GUI calls the class "ShowConnectDialog" which is supposed to call the dialog panel "ConnectDialog"
THE PROBLEM: the ConnectDialog starts ok, but with no dimensions (width=0 and height=0) and i have to resize it manually...by now
the ShowConnectDialog class:
public class ShowConnectDialog extends Command
{
private static final String name = "show connect dialog";
private JFrame parent;
public ShowConnectDialog(JFrame parentFrame)
{
super(name);
parent = parentFrame;
}
public void execute()
{
new ConnectDialog(parent, ClientApp.getIP(), ClientApp.getPort()).setVisible(true);
}
}
Thanks in advance ;)
PS: I use Netbeans
- 01-24-2011, 04:22 PM #2
Try setting component.setPreferredSize()?
- 01-24-2011, 05:27 PM #3
You don't really show us enough of the code to tell you what's going on. I recommend you provide an SSCCE that demonstrates what you're doing.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 01-24-2011, 07:03 PM #4
Member
- Join Date
- Dec 2010
- Posts
- 6
- Rep Power
- 0
Well I don't know if to put [SOLVED] because I actually solved it
but I don't like it too much...
I put:
setSize(190,300);
in the ConnectDialog constructor, because the size on start was (0,0) ...
why was it (0,0)? by now thats a mystery to me.
@quad64bit: no the setPreferredSize() didn't work.
@KevinWorkman: As I design the form non programatically, I don't think more code will illustrate the problem, I think it is one of those shits related to some Jform property or something...
thanks anyway ;)Last edited by krimen_sp; 01-24-2011 at 07:11 PM.
- 01-24-2011, 07:06 PM #5
Why don't you like that? And why would you not mark it solved if it has been solved? Otherwise, people will continue reading this, which is a waste of time if you aren't looking for a solution.
But again, we don't know what you're doing, so we can't really comment on what's happening. For example, what kind of layout are you using? How are you displaying the dialog?How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 01-24-2011, 07:39 PM #6
After you called setPreferredSize(), did you call pack() on the outer component?
- 01-24-2011, 07:41 PM #7
Member
- Join Date
- Dec 2010
- Posts
- 6
- Rep Power
- 0
If you look at my first intervention, you'll find how do I display the dialog, to sum up i do:
I have a main GUI with a button called CONNECT
when I press CONNECT, the button calls ShowConnectDialog.execute()
then ShowConnectDialog.execute() defines a new ConnectDialog
this new ConnectDialog should have the default dimensions without me having to specify them again in the constructor of ConnectDialog, again doing so solves the problem.
but why do I have to specify the dimensions again, if I don't do it in any other JPanel, and this JPanel was created from scratch, like the others?
This solution is just papering over the cracks it does not solve the main problem underlying.
PS: the layout was BorderLayout, and no, no other layout solved the problem.
- 01-24-2011, 07:43 PM #8
Member
- Join Date
- Dec 2010
- Posts
- 6
- Rep Power
- 0
@quad64bit: mmm I'll try that...
- 01-24-2011, 07:45 PM #9
Have you tried calling pack() as was suggested?
Edit- Nevermind, I didn't see your most recent post.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
Similar Threads
-
Setting text width and height in PDFBox
By svenskmand in forum Advanced JavaReplies: 0Last Post: 12-21-2010, 12:23 AM -
Width (-1) and height (-1) cannot be <= 0
By LovJava in forum AWT / SwingReplies: 5Last Post: 04-24-2010, 12:16 AM -
I want set HEIGHT, WIDTH for Button
By manhtungtnk28@gmail.com in forum AWT / SwingReplies: 3Last Post: 11-16-2009, 07:26 AM -
Using setBounds (x.y,width,height) constructor
By hitmen in forum AWT / SwingReplies: 3Last Post: 03-06-2009, 12:12 PM -
Get Image Height and Width
By neeraj.singh in forum AWT / SwingReplies: 10Last Post: 02-18-2009, 01:09 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks