Skip to main content
added 335 characters in body
Source Link
Aron_dc
  • 383
  • 2
  • 9

Please give some code snippets. Normally you would use a JFrame as your window and add up your elements eventually using some kind of LayoutManager.

edit after codesippet appeared:

You have 3 main problems that I can figure out from this snippet.

  1. Why do you set the layout of the frame to null? Just take the standard.
  2. You are missing frame.pack() before the frame.setVisible(true) this would pack all the Elements (e.g. the Textfield) according to the used layout
  3. You centralize all your code to one class (this) it is your Canvas, and also key-,action-, and mouse listener. You should put them in different classes or at least make a Listener Class that handles all the logic.

Please give some code snippets. Normally you would use a JFrame as your window and add up your elements eventually using some kind of LayoutManager.

Please give some code snippets. Normally you would use a JFrame as your window and add up your elements eventually using some kind of LayoutManager.

edit after codesippet appeared:

You have 3 main problems that I can figure out from this snippet.

  1. Why do you set the layout of the frame to null? Just take the standard.
  2. You are missing frame.pack() before the frame.setVisible(true) this would pack all the Elements (e.g. the Textfield) according to the used layout
  3. You centralize all your code to one class (this) it is your Canvas, and also key-,action-, and mouse listener. You should put them in different classes or at least make a Listener Class that handles all the logic.
added 7 characters in body
Source Link
Aron_dc
  • 383
  • 2
  • 9

GivePlease give some code snippets. Normally you would use a JFrame as your window and add up your elements eventually using some kind of LayoutManager.

Give some code snippets. Normally you would use a JFrame as your window and add up your elements eventually using some kind of LayoutManager.

Please give some code snippets. Normally you would use a JFrame as your window and add up your elements eventually using some kind of LayoutManager.

Source Link
Aron_dc
  • 383
  • 2
  • 9

Give some code snippets. Normally you would use a JFrame as your window and add up your elements eventually using some kind of LayoutManager.