• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Making a TextField  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone ^^

i am programming a game, and i wanted to make an LoggIn window where you can put in email username password etc. in. The Problem is that a JTextField doesnt work, so i need to programm the textfield for myself. Everyone works at all but it is just taking the Uppcase of the letters A, Z, S a.e. But i want to have lower and upper case letters. Also if you press Backslash, it writes Backslash in the String. Would be cool if you can help me Sry for my bad English at all im from Germany ^^



Here is where the KeyListener for the Textfield is in. The rest of the Class is just Graphic things, but if you need it too :



That is the full code of this class. I am using a GameStateManager so this is just the GameState for managing the screen which is shown when you start the game.

Thanks for your help ^^

I know it is a repost but i couldnt edit my latest topic :/
 
Rancher
Posts: 427
6
Fedora IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to do with the textfield that is not possible already?
 
Fabian Stetter
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Al Hobbs wrote:What are you trying to do with the textfield that is not possible already?



The problem is, i cant place an textfield... in my main is the JFrame



But if i try to add an JTextField in the LoggingInState. It is not possible because i already set the JFrame on Visible in the Main. I also tried to move the setVisible into the LoggingInState (I called the startState). But when i add an JTextField, the TextField starts to flicker over the background image.

 
Al Hobbs
Rancher
Posts: 427
6
Fedora IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why dont you put stuff in the jframe before you start like in the main method?
 
Al Hobbs
Rancher
Posts: 427
6
Fedora IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why dont you make a panel that has all the stuff you need like textfield etc then add it to the jframe?  
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!