0

I am struggling with something regarding java swing....I need to know how the linear text fields in most google apps are made....the ones where there is only one line in the bottom and how can I make them interactive. I don't need the app designer in net beans(that's our instructor)..Anyone can help please?

PS: I tried so hard to look up for such a thing but all I find is a drag and drop design. I searched everywhere but I found nothing.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
TSS DRX
  • 25
  • 6
  • This has nothing to do with the IDE and everything to do with the text field. Tags changed to reflect that. – Andrew Thompson Jul 26 '20 at 13:02
  • 1
    *"I don't need the app designer in net beans(that's our instructor)"* The instructor is wise, and doing us all (*especially* you) a favor. To be able to use those designers effectively, you *first* need to understand how to code GUIs purely with .. code. Furthermore, using pure code means the GUI is portable across IDEs. – Andrew Thompson Jul 26 '20 at 13:10

1 Answers1

2

The design of the graphic component in Google app is depending to the mobile operative system. In iOS and Android you will have different design for the same component, as you can see:

enter image description here

If you want to change the design of a graphic component (in an App or, in this case, in Java Swing) you have to write a Custom text field.

You can read Customizing JTextField for a simple example.

Calaf
  • 1,133
  • 2
  • 9
  • 22
  • 1
    @AndrewThompson Thanks for your suggestions: next time I will pay more attention. I've removed the last sentence of my answer. – Calaf Jul 26 '20 at 13:43
  • Well, I am still a beginner regarding Swing.....I know the basics and everything but I have no idea about other methods and what they'll do....so pretty much I didn't understand the thread of insets because I have no idea about insets...are they related to the borders around a component? – TSS DRX Jul 26 '20 at 15:02
  • @TSSDRX try to set `myJTextField.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.GRAY));`. I can't test it now, but it should work... – Calaf Jul 26 '20 at 15:11