Home » Archives for Ilias Tsagklis » Page 11

Author Archives: Ilias Tsagklis

Avatar photo
Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.

Create a Frame example

Bipartite Graph

In this example we are going to show you how to create a Frame in a Java Desktop Application. This is a very important part of creating your own graphics for the applications you build. The Frame is the single most important component you have to use in your application. In short to create a new Frame for your application ...

Read More »

Set tab color in JTabbedPane

With this example we shall see how to set tab color in JTabbedPane. In order to do that, one should follows these steps: Create a new JFrame. Call frame.getContentPane().setLayout(new GridLayout(1, 1) to set up grid layout for the frame. Use JTabbedPane(JTabbedPane.TOP) to get a JTabbedPane. Use tabbedPane.setForeground(Color.green) to set foreground color. Use tabbedPane.setBackground(Color.red) to set the background color. Use tabbedPane.addTab to add a tool tip. Let’s see the code: package ...

Read More »

Get tab info in JTabbedPane

In this example we are going to see how to get the tab info in a JTabbedPane component of a Java Desktop Application. Basically all you have to do for it is to: Create a new JFrame. Call frame.getContentPane().setLayout(new GridLayout(1, 1) to set up grid layout for the frame. Use JTabbedPane(JTabbedPane.TOP) to get a JTabbedPane. Use tabbedPane.addTab to add a tab. Use tabbedPane.getTabCount() to get the number of tabs. ...

Read More »

Enable scrolling tabs in JTabbedPane

With this example we shall show you how to enable scrolling in a JTabbedPane component of a Java Desktop Application. In order to do that you just have to follow these steps: Create a new JFrame. Call frame.getContentPane().setLayout(new GridLayout(1, 1) to set up grid layout for the frame. Use JTabbedPane(JTabbedPane.TOP) to get a JTabbedPane. Use tabbedPane.addTab to add a tab. Use tabbedPane.getTabRunCount() to get the number of tabs. Use tabbedPane.getTabLayoutPolicy() to ...

Read More »

Create JTabbedPane example

With this example we shall show you how to create a JTabbedPane component in a Java Desktop Application. This is a very important GUI component in a graphical application, because it lets you create very easy to use interfaces and enable the user to provide input to the application easily and all in all it’s quite an elegant way to ...

Read More »

Get/Set divider location in JSplitPane

In this example on how to get or set the location of the divider in a JSplitPane component of a Java Desktop Application. In order to do that you have to follow these steps: Create a new JFrame. Call frame.getContentPane().setLayout(new FlowLayout()) to set flow layout for the frame. Create two String arrays that will containt the contents of the two areas of theJSplitPane. Create ...

Read More »

Handle scrollbar value changes in JScrollPane

In this example we are going to see how to handle scroll bar value changes in a JScrollPane component. You can use this when you want to know exactly what portion of the screen the user is examining. Additionally you can use this to create some very interesting UIs. For example you can change the application behavior according to the ...

Read More »

Create JScrollPane example

In this example we are going to see how to create a JScrollPane container in a Java Desktop Application. This is one of the most important components in a GUI application, especially when your client code has to handle and to display a large amount of data. It is very simple to create a JScrollPane. All you have to do ...

Read More »

Create file chooser dialog

In this tutorial we are going to learn how to create a File Chooser Dialog in a Java Desktop Application. We all use file chooser dialogs on a daily basis. It is a very important component when you want to upload a file or to process a file in a GUI Application, because it lets the user choose the file ...

Read More »

Get selected value from JList

In this example we are going to learn how to get the selected value form a JList in a Java Desktop Application. This example is very useful because JList component provides a very easy way to get user input, especially when you want to give the user a number of specific options. In order to get the selected value from ...

Read More »