Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package wan.dev.sample.tabbedpanejtable;
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JScrollPane;
- import javax.swing.JTabbedPane;
- import javax.swing.JPanel;
- import javax.swing.JTable;
- public class d {
- private JFrame frame;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- d window = new d();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public d() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.setBounds(100, 100, 450, 300);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
- tabbedPane.setBounds(0, 0, 434, 262);
- frame.getContentPane().add(tabbedPane);
- JPanel panel = new JPanel();
- panel.setLayout(null);
- Object rowData[][] = {
- { "Row1-Column1", "Row1-Column2", "", "", "", "", "" },
- { "Row1-Column1", "Row1-Column2", "", "", "", "", "" },
- { "Row1-Column1", "Row1-Column2", "", "", "", "", "" },
- { "Row1-Column1", "Row1-Column2", "", "", "", "", "" },
- { "Row1-Column1", "Row1-Column2", "", "", "", "", "" },
- { "Row2-Column1", "Row2-Column2", "Row2-Column3", "", "", "",
- "", "" } };
- Object columnNames[] = { "Column One", "Column Two", "Column Three",
- "", "", "", "" };
- JTable table = new JTable(rowData, columnNames);
- JScrollPane scrollPane = new JScrollPane(table);
- tabbedPane.addTab("table", null, scrollPane, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment