小编Sev*_* B.的帖子

使用JRadioButtons更改JTable中的列不会刷新结构

我删除了大部分GUI以保持代码简短.

我有3个JRadioButtons的buttongroup来选择我想要在我的JTable中显示的表模式,它包含在JScrollPane中

我试图使用fireTableStructureChanged(),fireTableDataChanged()JTable.repaint()无济于事.谁能帮我?

这是一个使用我的配置运行窗口但不更新表的简单示例.

public class test1 implements ActionListener {

private boolean payrollActive = false;

private JPanel mainPanel = new JPanel();
private JTable dataTable;

private Vector<String> courseColumns = new Vector<String>();
private Vector<String> courseColumnsPay = new Vector<String>();
private Vector<String> profsColumns = new Vector<String>();
private Vector<String> offSpaceColumns = new Vector<String>();

public test1() {
    //Add columns for tables
    String[] courseColsPay = {"Year", "Program", "Course", "Code", "CCCode", 
            "Weight", "Session", "Section", "Day", "STime", "FTime", 
            "BookedRM", "EnrolCap", "Description", "ProfFName", 
            "ProfLName", …
Run Code Online (Sandbox Code Playgroud)

java swing jtable actionlistener jradiobutton

4
推荐指数
2
解决办法
142
查看次数

标签 统计

actionlistener ×1

java ×1

jradiobutton ×1

jtable ×1

swing ×1