• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Eiclipse Gui help.

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
So question i got how to add the array into label, when i push the button next it takes next value from array and so on till 10 questions have been displayed.


when i add a label to design log it generates


How can i put so it takes first index from array and displays it into lable and when you push button next it takes next array value and displays it.
I'm kinda a new to eclipse gui thingy, i tried -
 
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The solution for this is very, very simple: quite using the auto coder, gui builder, and learn to do it yourself. You say: "How do you know that?!" Because I have seen literally 100's of developers learning Java that get to the
very same place you are now--the auto coder won't do it for me and I don't know how to do it--so help.

That may sound like a very arrogant and callus remark, but in the long run, knowing how to build the gui yourself will allow you to avoid the pitfalls and dead end scenarios inevitably waiting for the gui builder/auto coder user.
You are new to Java and looking to take the shortest route to getting your code down on paper--don't. Time and time again I see people coming in here asking for help that really do not know enough Java to understand how
to be helped. So if we told you to add a button and a listener, then make the process to have your code do what you ask--would you understand what we're saying? No. Why? Because you need to learn the fundamentals first.

Java Really Big Index this link is to basically the free Java gold mine of knowledge. It's based at Oracle, the guys who bought out Sun (Java's creator), and
also contains links to their learning paths (top of the page).

So to answer your question:
Add a button, make a listener, have you listener call your process that does what you want with the data in the array and the label.

Can't? Then there is some really good info you should look at in that link.
 
Kristers Drozds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Les Morgan wrote:


Well what is better in your opinion to learn to write pure code or use gui builder?
 
Les Morgan
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kristers,
After you learn enough Java to not need to use a gui builder or auto coder, then personally, I don't care how you do it--Infinite monkeys typing on infinite laptops will produce every great piece of code ever thought of, or ever will be thought of. But in reality until you can do it without, then you are playing Russian roulette with every project you decide to start. You will at some time find you are at that point where your trusty auto coder or gui builder had brought you to a dead end, and it wants you to run down that dead end and it will not lead any where else. Then you can your entire work and start over, but guess what? If you have to run down the auto coder or gui builder route because you cannot do it yourself, then WHAM, you will find yourself there again. I have seen this time and time again--the auto coders and gui builders are better than there were 2 decades ago, but then people just trust them more too and WHAM--they gotcha.

So, in short, learn how to do it manually, then you can see if you like how that auto coder/gui builder works for you or if you, like many of us, decide it's just not worth the risk (not to mention the hassle getting the naming to acceptable project convention).
Les

Kristers Drozds wrote:

Les Morgan wrote:


Well what is better in your opinion to learn to write pure code or use gui builder?

 
Les Morgan
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Les Morgan wrote:Kristers,
After you learn enough Java to not need to use a gui builder or auto coder, then personally, I don't care how you do it--Infinite monkeys typing on infinite laptops will produce every great piece of code ever thought of, or ever will be thought of. But in reality until you can do it without, then you are playing Russian roulette with every project you decide to start. You will at some time find you are at that point where your trusty auto coder or gui builder had brought you to a dead end, and it wants you to run down that dead end and it will not lead any where else. Then you can your entire work and start over, but guess what? If you have to run down the auto coder or gui builder route because you cannot do it yourself, then WHAM, you will find yourself there again. I have seen this time and time again--the auto coders and gui builders are better than they were 2 decades ago, but then people just trust them more too and WHAM--they gotcha.

So, in short, learn how to do it manually, then you can see if you like how that auto coder/gui builder works for you or if you, like many of us, decide it's just not worth the risk (not to mention the hassle getting the naming to acceptable project convention).
Les

Kristers Drozds wrote:

Les Morgan wrote:


Well what is better in your opinion to learn to write pure code or use gui builder?

 
Kristers Drozds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to put an array with questions and answers in the same gui file? Cause it's telling me that i need to make another file for that.
also i did make another file in the same package and import it into gui file but it still telling me that variable is unknown.

 
Les Morgan
Rancher
Posts: 1093
29
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know what problem your code is supposed to highlight, because there aren't any file references in it. So I will answer your question in general:

You cannot read and write to the same file at the same time. You can with a database. There is nothing that expressly forbids putting questions and answers in the same file, I have done so on many occasions, but you cannot write to a file that you have open to read and you cannot read from a file you open to write.

"import it into gui file but it still telling me that variable is unknown" this line is nonsensical to me, I cannot tell what it is that you are trying to say--your gui is not a file, a variable can be unknown if you try to reference it from a scope that is outside of the scope of it's reference variable.

Kristers Drozds wrote:Is it possible to put an array with questions and answers in the same gui file? Cause it's telling me that i need to make another file for that.
also i did make another file in the same package and import it into gui file but it still telling me that variable is unknown.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic