| |
| |
| |
|
Page: 1 2
Comments:
<0> If it's Java, and not Javascript! <0> joseph: it's possible, yeah :)( <1> I got a cl*** which extends JFrame, and I try to call the method .removeAll() from another cl***. It seems to work because after I call it, I can click any of the buttons, they seem frozen.. But they are still there! it seems that I needto "repaint" the JFrame somehow, but I don't know which method does that(if thats the case) <1> I don't use threads.. except if threads are created from the swing compoments or something? <0> Of course <0> Swing uses a single thread to do all it's message handling, painting etc <1> I see.. <0> If you go off and do stuff, and never finish doing stuff (give it back toswing), events won't pump, and everything will freese <2> repaint() repaints and validate() reorganizes child components
<1> I see... I think you hit the spot there.. although I'm not exacly sure how to fix it.. maybe if I could give you a little bit more information you could be more specific as well.. <0> LLaffer: when you write swing apps, they should be event-drive. responding to swing events etc with very short/quick methods <0> Any serious processing etc needs to be done in a different thread <1> MainMenu is a cl*** which extends JFrame, and in the constructor it creates an instance of another cl*** called SecreteryPanel which extends JPanel.. then it adds this panel on the frame's panel. Now Secretery Panel has some buttons, which if clicked, the ActionListener calls a public method from the MainMenu instance(p***ed as a paremeter to the Secretery Panel) which method calls .removeAll(); <0> That's fine <1> so how come the MainMenu swing gets busy then? <0> There's just one swing thread. Where is your program at the time it's hanging? <1> I click on the Secretery Panel's button which calls a public method from the MainMenu instance. I have a system.out in that method which prints out fine. the next instruction inside that method is this.getContentPane().removeAll(); .. it seems to be doing the job, but the buttons are still there, all frozen.. they don't get removed <1> However, if I call the same method from the MainMenu's constructor in the beginning, all compoments are getting removed just fine <2> I had the same problem, when I was trying to remove myself - a JButton from panel as a reaction to click on me <0> what does the method in Secretary do *next*? <0> You connected an event-handler to the Secretary button, right, and it called your method? WHen it does this you're *IN* the swing thread <0> You need to handle things as quickly as possible, and then return <0> Don't try and wait for anything, or do anything that takes, hmmm, more than 1/10 second <1> Isee... it does nothing else <1> it's something like this: public void actionPerfoemred(ActionEvent e) { if (e.GetActionCommand().equals("clearAll")) {parentMainMenu.clearAllMethod(); } } <0> That should be fine. What does clearAllMethod() do? <1> public void clearAllMethod() { System.out.println("This prints just fine"); this.getContentPane().removeAll(); } <1> the eventhandler is in the secretery Panel cl***, the clearAllMethod is in the MainMenu cl*** <0> That all sounds okay. Maybe you just need repaint() or validate() <1> ok will do <0> I haven't done swing in >2 years <1> thanks anyway <1> Cool! repaint did the trick! thanks LLyric and Pukeye <1> now for a question of finesse.. is this a proper way of doing things in java? P***ing the MainMenu instance as a parameter in the Secretery Panel and calling a clearAll method like that? is there a more effecient way to do something like this? this is my first experience in java, ever. I have no idea how everything should work <0> Why does the secretary panel need to fiddle with the main menu? <0> That basically makes it un-reusable, and highly coupled <1> that's what I didn't like myself... is there a way to alter a panel in the JFrame that Secretery Panel is in, other than itself? Say MainMenu's JFrame has a blank panel.. And Secretery Panel has 5 buttons and I want something different to display in that blank panel for every button <2> LLaffer: I just can tell, that there is no problem with efficiency (it's just part of your question) - instance of MainMenu is p***ed by reference (fast like pointer if you know C lang) <0> LLaffer: sounds like a tabbed panel? <0> Sounds like you want a frame for each set of controls <2> LLaffer: maybe you should check out inner cl***es (but maybe I'm wrong) - you can define your Secretery panel cl*** *inside* the definition of JFrame cl***, and then you have the instance of JFrame from Secr. panel like this: MyFrame.this <1> maybe this helps: www.intenseillusions.com/mainmenu.jpg <1> I'm not too much worried about effeciency in that sense.. more like, if it's a 'programming' correct method or will it give me problems later on.. <1> I only want one frame, and when a button from a menu is clicked, a new panel should be created in the center of that frame(the blank panel spot) <0> Even if you don't want to use a tabbed panel, that's what you need to build
<0> Don't muck around with hiding individual components <0> http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html <1> I can't use a tabbed panel.. it won't look like a program, it will look like a "settings"window.. <0> You can change how it looks however you want. But, my point was, you should use that design <0> not necessarily that actual component <1> so there's a way to use a tabbed component without the actual "tabs" graphics on top of each panel?and create new panels or draw anything I want for each tab? can I also useany layout I need inside every tab? <0> Tabbed Pannel just contains other panels <0> The parent container doesn't know anything about what's in the panels, as such, it just treats them as panels <1> ok I think I can take it from here <1> thank you very much, you've been really helpfull <0> np <0> have fun :) <1> ciao <3> is there a way in java to repeat a character several times like in perl e.g perl -e 'print "a"x20;' prints out a 20 times? <4> nnp: not that i know. <3> oh well <5> nasib... <6> hey <6> i'm creating a package with servlets, and i want to store CSS files inside this package too. please, how can i retrieve the css file (content) from inside the package? <6> may be <link rel="stylesheet" href="/MyResources?com.test.resources.mystyle.css">, but how? can somebody help me, please? <3> are you using tomcat or something? <1> Hi! New question:)... <1> is there any swing Help compoment that I could use which simulates a mechanism similar to Microsoft's .HLP editor in the Index tab, where you get to type a word, and as you type it,the results from the list below get filtered out? <1> or do I have to make one from scratch? <1> anyone attempted something like this before to point me the right way before I start? <7> Hiya guys <4> hi thunder <4> LLaffer: possibly related: http://www.google.com/search?hl=en&q=javahelp&btnG=Google+Search <6> nnp, sorry. i'm using apache tomcat 5.5.12 <8> guys my two cl***es interfaces appear on top of each other what code do i use to hide the cl*** contents from appearing on top my other cl*** <7> Javvaaaa: Huh? <8> i really dont know how to explain this <4> than no one can help you <7> Javvaaaa: is this in the editor? <8> but when i click on this button it goes to a new screen - the previous cl***es contents appears on the new screen, i want to hide that content <4> then rather <8> its looks all messy with all that content there <7> Javvaaaa: Focus.. IS IT THE EDITOR?? <8> editor no its the GUI? sorry is that what you mean <7> Javvaaaa: I don't understand what you mean by "on top of my other cl***" then. Is it some buttons or text fields that goes the wrong places or what do you mean? <4> Javvaaaa: consider learning java with the sun java tutorial. it is very well structured. <8> is it possible if someone can help me if i send the code ive spent a far while looking into it im sure its a one liner <8> or if someone tells me how to hide a cl***es visability on screen <9> helo everybody <9> someone speak spanish .?
Return to
#java or Go to some related
logs:
'CFileDialog' : undeclared identifier cant be banned #php #linux #linux palm treo 650 windowsx64 rapidshare.de Andi #AllNiteCafe #php #AllNiteCafe
|
|