• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot add tab in JTabbedPane from main.  RSS feed

 
Rocky Rocha
Ranch Hand
Posts: 59
Android Chrome Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a project in NetBeans (Its a text editor), and I want it to be able to open a file you drag onto it in the file browser. As far as I know, that is basically command line arguments. My code for the editor is as follows. Keep in mid, that it is one file, not by choice, but by requirement.

I cannot figure out how to add a tab to the editTabs. What do I do?
 
Rocky Rocha
Ranch Hand
Posts: 59
Android Chrome Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I should probably clarify. I want to add a tab, but I cannot. I am doing this in the main method on line 392. Thought that might be confusing.
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got basically the same code at line 341, as well. But both of them look sort of okay to me -- naturally I haven't spent the time to install NetBeans and try the code myself. So what's the problem?
 
John Joe
Ranch Hand
Posts: 443
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use editTabs in main method. The fastest way is add static in line 
 
Fred Kleinschmidt
Bartender
Posts: 572
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should not be doing that in main(). All of your variables are instance variables (and rightfully so).
Your run() method creates an instance of Main, and you should use that instance to do all of the work.
Your Main class should have oublic methods that can be used to do things such as adding tabs, etc.
 
Rocky Rocha
Ranch Hand
Posts: 59
Android Chrome Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, this question is a waste of your time. I apologize for wasting it and I hope that I didn't annoy you. (I am being serious, I sometimes come off as being sarcastic when I am not trying to)Please disregard this question.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!