- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to specify tab location to make it visible in the bottom with Java?
Use the setTabPlacement() method to set the tab location. To make it visible in the bottom, use the BOTTOM constant −
JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);
The following is an example to specify tab location to make it visible in the bottom −
package my; import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; public class SwingDemo { public static void main(String args[]) { JFrame frame = new JFrame("Technologies"); JTabbedPane tabbedPane = new JTabbedPane(); JPanel panel1, panel2, panel3, panel4, panel5; panel1 = new JPanel(); panel2 = new JPanel(); panel3 = new JPanel(); panel4 = new JPanel(); panel5 = new JPanel(); tabbedPane.setTabPlacement(JTabbedPane.BOTTOM); tabbedPane.addTab("PHP", panel1); tabbedPane.addTab("Blockchain ", panel2); tabbedPane.addTab("Matlab", panel3); tabbedPane.addTab("JSP ", panel4); tabbedPane.addTab("Servlet", panel5); frame.add(tabbedPane); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(550,350); frame.setVisible(true); } }
Output
Advertisements