I am getting following excpetion
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/divxdede/text/TimeFormat
at org.divxdede.swing.busy.ui.BasicBusyLayerUI.<init>(BasicBusyLayerUI.java:102)
at org.divxdede.swing.busy.ui.BasicBusyLayerUI.<init>(BasicBusyLayerUI.java:138)
at org.divxdede.swing.busy.JBusyComponent.<init>(JBusyComponent.java:105)
at jewelleryerpapplication.GUI.Gold.IssueToRep1.<init>(IssueToRep1.java:136)
at jewelleryerpapplication.GUI.Gold.IssueToRep1.Instance(IssueToRep1.java:164)
I added following Libraries to my project
When I added the JXBusyLayer
Component to my JFrame
(while wrapping existing JTable
Component with JXBusyLayer
Component) using the code below
JBusyComponent<JTable> busytblDetailInfo = new JBusyComponent<JTable>(tblDetailInfo);
myJFrame.add(busytblDetailInfo);
using the Link!
Edit
Added the library Commons-0.2 and the exception disappears.
Error 2 !
Now No Data is seen on the control(JTable) which is wrapped by JBusyControl.
Edit 2
Added the code below(by comment of @MadProgrammer) but the problem reamins no data to be viewed.
jFrame.remove(tblDetailInfo);
DefaultTableModel dtm = new DefaultTableModel(data, header);
tblDetailInfo.setModel(dtm);
JBusyComponent<JTable> busytblDetailInfo = new JBusyComponent<JTable>(tblDetailInfo_OrderInfo);
jFrame.add(busytblDetailInfo);
I found that it doesn't like being wrapped in a JScrollPane
which is weird in my opinion :P
(I lie, BusyComponent
"likes" being added to a JScrollPane
; but you probably don't want to)
public class TestBusy {
public static void main(String[] args) {
new TestBusy();
}
public TestBusy() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
}
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(new ContentPane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
public class ContentPane extends JPanel {
private JTable table;
public ContentPane() {
setLayout(new BorderLayout());
table = new JTable();
table.setFillsViewportHeight(true);
DefaultTableModel model = new DefaultTableModel();
model.addColumn("One");
model.addColumn("Two");
model.addColumn("Three");
model.addColumn("Four");
model.addColumn("Five");
model.addColumn("Six");
model.addColumn("Seven");
table.setModel(model);
JScrollPane scrollPane = new JScrollPane(table);
JBusyComponent<JScrollPane> busyComponent = new JBusyComponent<JScrollPane>(scrollPane);
add(busyComponent);
busyComponent.getBusyModel().setMinimum(0);
busyComponent.getBusyModel().setMaximum(10000);
busyComponent.setBusy(true);
BusySwingWorker<Object, Object[]> worker = new BusySwingWorker<Object, Object[]>(busyComponent.getBusyModel()) {
@Override
protected void process(List<Object[]> chunks) {
DefaultTableModel model = (DefaultTableModel) table.getModel();
for (Object[] chunk : chunks) {
model.addRow(chunk);
}
}
@Override
protected Object doInBackground() throws Exception {
for (int index = 0; index < 1000; index++) {
setProgress(Math.round((index / 1000f) * 100f));
publish(new Object[]{index, "B", "C", "D", "E", "F", "G"});
Thread.sleep(5);
}
return null;
}
};
worker.execute();
}
}
}