-1

I want to display the JTable table created from My Bill_Master database as like a message dialog in JOptionPane.showMessageDiaolg. I tried to display it using a new JFrame,but it was unsuccessful.

     JPanel panel = new JPanel(new GridLayout());        
        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setViewportView(table);
        panel.add(scrollPane);
       JOptionPane.showConfirmDialog(null, panel, "Bill Details",JOptionPane.OK_CANCEL_OPTION); 
4

1 回答 1

1

你应该试试这个逻辑。您应该使用JDialog而不是使用JPanel. 然后在上面添加JTable对象。它将创建与JOptionPane. 我认为这个链接会帮助你... http://www.coderanch.com/t/332805/GUI/java/dialog-box-JTable

于 2013-10-28T17:03:42.627 回答