Error with logic or repaint/revalidate Java JFrame

前端 未结 2 474
忘掉有多难
忘掉有多难 2021-01-23 03:52

What I am trying to do is this, when I enter the details it will validate if the textFiled is empty when a button is pressed, if it is empty it will display a message saying tha

2条回答
  •  清酒与你
    2021-01-23 03:59

    1. have look at DocumentListener,

    2. on start_up to enable only first JTextField, if any (up to you) character was typed into first JTextField, then enable second JTextField, and so on...,

    3. if you want to filtering, change or replace output came from keyboard the to use DocumentFilter

    4. change background for example to Color.red (from DocumentListeners events), in the case that one of JTextFields contains incorect lenght, data e.g.

    5. agree with HFOE about LayoutManagers

提交回复
热议问题