Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Making a TextField

 
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: 527
6
IntelliJ IDE Spring Fedora
  • 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: 527
6
IntelliJ IDE Spring Fedora
  • 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: 527
6
IntelliJ IDE Spring Fedora
  • 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?  
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic