Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java //抛出新的UnsupportedOperationException(“尚未支持”)//若要更改生成的方法体,请选择工具|模板。 归还这个; } } /*选择选项时添加表*/ private void new_FileMenuActionPerforme_Java_Swing_Netbeans 7 - Fatal编程技术网

Java //抛出新的UnsupportedOperationException(“尚未支持”)//若要更改生成的方法体,请选择工具|模板。 归还这个; } } /*选择选项时添加表*/ private void new_FileMenuActionPerforme

Java //抛出新的UnsupportedOperationException(“尚未支持”)//若要更改生成的方法体,请选择工具|模板。 归还这个; } } /*选择选项时添加表*/ private void new_FileMenuActionPerforme,java,swing,netbeans-7,Java,Swing,Netbeans 7,//抛出新的UnsupportedOperationException(“尚未支持”)//若要更改生成的方法体,请选择工具|模板。 归还这个; } } /*选择选项时添加表*/ private void new_FileMenuActionPerformed(java.awt.event.ActionEvent evt) { TabUI tu=新TabUI(); jPanel2.add(tu); } 已经提出了一个类似的问题,其中可能包含您的解决方案。(已接受的答案解释了您无法单击组件的原因)请

//抛出新的UnsupportedOperationException(“尚未支持”)//若要更改生成的方法体,请选择工具|模板。 归还这个; } } /*选择选项时添加表*/ private void new_FileMenuActionPerformed(java.awt.event.ActionEvent evt) { TabUI tu=新TabUI(); jPanel2.add(tu); }
已经提出了一个类似的问题,其中可能包含您的解决方案。(已接受的答案解释了您无法单击组件的原因)请参阅:您需要一个
CellEditor
/*table class that contains the panel*/


public class TabUI extends JTable{

    public LeftPaneUI lp;
    public TabUI(){

        DefaultTableModel dm = new DefaultTableModel();
        dm.setDataVector(new Object[][] {{  } }, new Object[] {"","" });
        this.setModel(dm);

        lp = new LeftPaneUI();
        this.getColumnModel().getColumn(0).setCellRenderer( lp );
        this.setRowHeight( 95 );
        this.getColumnModel().getColumn(0).setPreferredWidth(160);
        this.getColumnModel().getColumn(1).setPreferredWidth(405);
    }

}


/*the aforementioned panel*/


public class LeftPaneUI extends javax.swing.JPanel implements TableCellRenderer {

    /**
     * Creates new form LeftPaneUI
     */
    public LeftPaneUI() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        index_No = new javax.swing.JLabel();
        type = new javax.swing.JLabel();
        color = new javax.swing.JLabel();
        index_val = new javax.swing.JLabel();
        color_val = new javax.swing.JLabel();
        entities = new javax.swing.JButton();
        type_val = new javax.swing.JComboBox();

        index_No.setText("Index No.");

        type.setText("Type");

        color.setText("Color");

        index_val.setText("random");

        color_val.setForeground(new java.awt.Color(235, 24, 24));
        color_val.setText("red");

        entities.setText("Word Entities");

        type_val.setEditable(true);
        type_val.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Select", "Generic", "Ubiquitous", "Event Driven", "Unwanted", "State Driven", "Optional" }));
        type_val.setRequestFocusEnabled(true);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(color)
                                .addGap(33, 33, 33)
                                .addComponent(color_val))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(index_No)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(index_val))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(type)
                                .addGap(18, 18, 18)
                                .addComponent(type_val, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(entities)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(index_No)
                    .addComponent(index_val))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(type)
                    .addComponent(type_val, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(color_val)
                    .addComponent(color, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(entities, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(3, 3, 3))
        );
    }// </editor-fold>                        


    // Variables declaration - do not modify                     
    private javax.swing.JLabel color;
    private javax.swing.JLabel color_val;
    private javax.swing.JButton entities;
    private javax.swing.JLabel index_No;
    private javax.swing.JLabel index_val;
    private javax.swing.JLabel type;
    public javax.swing.JComboBox type_val;
    // End of variables declaration                   

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return this;
    }
}


/*adding the table when an option is selected*/

private void new_FileMenuActionPerformed(java.awt.event.ActionEvent evt) 
{

        TabUI tu = new TabUI();     
        jPanel2.add(tu);
}