Lowyat.NET Forums

Welcome Guest ( Log In | Register )

LYN wins Intel-Lenovo-Tangs Blogathon challenge. Thank you everybody!
 
RSS feedBump TopicReply to this topicStart new topicStart Poll

Outline · [ Standard ] · Linear+

> how to solve? (Java)

PVCpipe
post Oct 28 2009, 06:23 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #1


On my way
****

Group: Senior Member
Posts: 540
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Nov 2005
From: k.terengganu.. alone.. with my bass...play.. alone






» Click to show Spoiler - click again to hide... «


my idea is to pop a joptionpane box to receive input from user from keyboard.... but i cant make it work here... im not familiar with the windowadapter stuff there.... so how can i solve the prob?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
anti-informatic
post Oct 28 2009, 09:55 AM
Show posts by this member only |This post's rating (0+, 0-) | Post #2


Getting Started
**

Group: Junior Member
Posts: 261
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2006




I dont recall input box with Joptionpane need windowadapter or other stuff

I dont need whats window listener for as i never learn until that instance

But in ur case, ur input box does not need other things to make it run but the code itself

Try enter Joptionpane.showinputdialog 1st, compile make sure it work, then oni add other code.

If im not mistaken, the box got problem is because of the code below

Just an opinion from java novice
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
PVCpipe
post Oct 28 2009, 08:17 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #3


On my way
****

Group: Senior Member
Posts: 540
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Nov 2005
From: k.terengganu.. alone.. with my bass...play.. alone






thanks but im sorry coz dont understand... the code actually i get from a tutorial... all the other tutorial ive seen, not one teach how to get input from user via keyboard.... it just, JOptionPane dont work there coz im pretty sure the code works in other java prog that i run....

is there any tutorial on how to draw these basic shape with getting the input from the keyboard?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
anti-informatic
post Oct 28 2009, 08:54 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #4


Getting Started
**

Group: Junior Member
Posts: 261
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Dec 2006




QUOTE(PVCpipe @ Oct 28 2009, 08:17 PM)
thanks but im sorry coz dont understand... the code actually i get from a tutorial... all the other tutorial ive seen, not one teach how to get input from user via keyboard....  it just, JOptionPane dont work there coz im pretty sure the code works in other java prog that i run....

is there any tutorial on how to draw these basic shape with getting the input from the keyboard?
*


If u just looking for accepting input from user, the most basic one is joptionpane input dialog then
the most basic thing need is first, import javax.swing.JOptionPane
then declare a new variable and assign to showinputdialog like this
String output=JOptionPane.showInputDialog("Enter message: ");
basically this adi accept an input from user

I duno about drawing shape and so on....
But u can try changing ur choice variable in ur void main into something else like input, like this
String input=JOptionPane.showInputDialog("Enter ur choice");
because choice is adi declare above
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
winmxbb
post Oct 28 2009, 11:59 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #5


Getting Started
**

Group: Junior Member
Posts: 58
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Jan 2008




QUOTE(PVCpipe @ Oct 28 2009, 06:23 AM)
» Click to show Spoiler - click again to hide... «


my idea is to pop a joptionpane box to receive input from user from keyboard.... but i cant make it work here... im not familiar with the windowadapter stuff there.... so how can i solve the prob?
*



String choice;
choice=JOptionPane.showInputDialog("Enter your choice: ");
System.out.println("choice="+choice);
why u say cannot?

u try print it out!
coz i can see what i keyin
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
taitianhin
post Oct 29 2009, 03:46 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #6


Getting Started
**

Group: Junior Member
Posts: 82
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Apr 2005
From: too far to see





QUOTE(winmxbb @ Oct 28 2009, 11:59 PM)
String choice;
  choice=JOptionPane.showInputDialog("Enter your choice: ");
  System.out.println("choice="+choice);
why u say cannot?

u try print it out!
coz i can see what i keyin
*


ur case looks alright. u did not call the function properly is it?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Gemini
post Oct 29 2009, 05:40 PM
Show posts by this member only |This post's rating (0+, 0-) | Post #7


Getting Started
**

Group: Junior Member
Posts: 202
Ratings earned: 0+, 0-
Ratings given: 0+, 0-

Joined: Feb 2005




This code sample is to illustrate how to draw lines and circle in java UI. it's not meant to ask questions and get user answer.

What you need is not complicated. Refer to http://forum.lowyat.net/topic/1209214 on how to accept input from user using java UI.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Bump TopicReply to this topicTopic OptionsStart new topic
 



----debug section please ignore----
Lo-Fi Version Time is now: 24th November 2009 - 05:01 AM
All Rights Reserved 2003-2009 Vijandren Ramadass (~living on a prayer~)