Results 1 to 1 of 1
- 08-28-2012, 12:53 PM #1Member
- Join Date
- Jul 2012
- Rep Power
Quick question about right way to add a custom jtoolbar
Hy guys a quick question:
I have a jframe where i want to add a custom jtoolbar, a jlist in a scrollable pane.
I made the custom jtoolbar because i want all buttons to be added in its constructor and not in frame's code(because lot of code, toolbar has its own file, jlist its own file)
The problem is that button's actions make changes to my jList (which is not accessible in toolbar's class file where buttons actions are implemented).
What's the correct way to interact with the JList?
1. Pass it to the Jtoolbar in toolbar's constructor?
2. Get it from the frame(searching for it in frame's components)?
3. Not implementing the actions in toolbar's class, but in main frame and set actions to the buttons in main frame( i won't like this solution but if this is correct way, i'll do it like that)
- By stuckonjava in forum New To JavaReplies: 4Last Post: 05-07-2012, 11:46 AM
- By swp in forum New To JavaReplies: 3Last Post: 10-19-2011, 04:16 AM
- By biggerthanblue in forum New To JavaReplies: 2Last Post: 04-10-2011, 04:33 AM
- By Ryan10 in forum New To JavaReplies: 63Last Post: 03-02-2011, 02:11 AM
- By shadycharacter in forum New To JavaReplies: 2Last Post: 04-22-2010, 10:06 PM