Alright, so last chapter we wrote a GUI for our notepad. But how does it all work? Let's take it section by section.
JTextArea - This is something similar to what your are reading this in right now. It's a multi-lined, scroll bar enabled word wrapping text area.
JMenuBar-It's a menu bar. You see these everywhere. It's the bar running along the top of a window / screen that contains menus.
JMenu - It's a menu. You click it, and menu items pop down.
JMenuItem - It's a menu item. When you click a menu, it's one of the things that drop down.
JScrollPane - It's the thing that allows scroll bars to be attached to other components, in this case, the JTextArea
setContentPane() - this is just a version of add(), but it only allows a single pane.
menu.addSeperator() its the line that allows grouping of menu items
setJMenuBar() - adds a JMenuBar to the top of the screen, regardless of what's there.
Most of the new code is self-explainitory, and that's a great thing about Java. Next chapter, we'll start adding some functionality to our code.
YOU ARE READING
Java Swing GUI Development
Non-FictionLearn all the necessities of Java Swing GUI development right here, from me, not some huge cooperate company, that can't find a good way to get the message across. Learn it here, learn it once.
