Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

swings and eventhandeling  RSS feed

Vandana Dubey
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of the below components are JComponents:
I hv a frame in which there are p1, p2, p3 & p4 panels.
p4 has a button called ok. All of p1, p2, p3 and p4 are in frame.
In p1, there is a radio butoon(rb) and a combo box(cmb). This cmb has many items which r names of differnt learning algorithms say l1, l2 and so on.
Simultaneously in p3 there are different parameter panels(param) which appear acc to learning rule selected from p2.
Whn ever rb is enabled thn by defalut the 1st l1's parametrs panel appear and this param has many textfields and cmbs.
my 1st prob is tht the name of learning rule does not appear as the title of param. I hv used Titledborder method.
my 2nd prob is tht: There r various textFields and cmbs in each param. each of the textfields and cmbs contain default double values and String values resptively. The prob is tht if i click directly on ok button in p4 thn all the default values are svaed in a file. But as soon as i change their values thn those values r not saved, i have to explicitly press "ENTER" key.
I want tht whitout pressing "enter key" on keyboard i shd be able to save those changed values. And this shd be applicable for algorithi's resp param panel's textfields and cmbs.
If i am a bit confusing thn u can just refer to any of the standard microsoft products such as "word2000". If user selects any option and changes default settings he/she is not forced to press "enter key"! to save his changes.
I want tht for any of my learning rule the param panel which appears and which has textfields and cmbs shd be able to save the changed values given by user without pressing"ENTER" key. he/she shd be able to save the changes just by pressing the ok button of panel p4. Also he the user comes back and selects the earliear learning rule's param panel thn whtever recent settings did he do shd be visible.
pl, help. I am trying this for months!!!
Nathan Pruett
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would it be possible to post your code... it is hard to get an idea of what needs to be done without seeing exactly how you are doing it.
Prob. 1 : I am not sure if this is the solution, since I have not used Swing all that much, but I think you have to create a new TitledBorder with the string you want each time and then assign that border to the Param panel... you probably have to redraw the Panel too.
Prob. 2 : I am not sure why this is happening... the process of saving these values to a file should be part of the OK button's ActionListener... maybe you have this functionality under a KeyListener for the enter key? Without looking at your code I do not know for sure...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!