Open londonreturns opened 8 months ago
line: 13 The type com.toedter.calendar.JDateChooser is not accessible.
That looks a lot like compilation errors in your workspace.
Can you show me what the project looks like? Do you have a module-info.java file which is missing whatever module your custom JDateChooser is coming from?
line: 13 The type com.toedter.calendar.JDateChooser is not accessible.
That looks a lot like compilation errors in your workspace.
Can you show me what the project looks like? Do you have a module-info.java file which is missing whatever module your custom JDateChooser is coming from?
i added jcalender in module-info.java file, and it works fine
Alright then... this is the example I've set up.
I have the project ModularProject1, with a stub class JCalendar:
package test.jcalendar;
import javax.swing.JPanel;
public class JCalendar extends JPanel {
}
and the module-info.java:
module jcalendar {
requires java.desktop;
exports test.jcalendar;
}
This class is used in a separate project called ModularProject2, where the JCalendar is used by the class MainFrame:
package test;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import test.jcalendar.JCalendar;
public class MainFrame extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainFrame frame = new MainFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MainFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.add(new JCalendar());
setContentPane(contentPane);
}
}
and the module-info.java:
module ModularProject2 {
requires java.desktop;
requires jcalendar;
}
Opening the MainFrame class with the Design editor works without problem...
This tells me that there is no issue with how WindowBuilder handles the module system. Which makes be believe that there is something wrong with your projects and I therefore need to know what your workspace looks like, if you want me to help you.
As a slightly different question: What steps do you take that cause this error? Because the code snippet you show in your initial post doesn't reference the JDateChooser class and should open on its own.
lỗi này là sao vậy ạ
@vanquanle
See:
line: 13 The type com.toedter.calendar.JDateChooser is not accessible.
That looks a lot like compilation errors in your workspace. Can you show me what the project looks like? Do you have a module-info.java file which is missing whatever module your custom JDateChooser is coming from?
i added jcalender in module-info.java file, and it works fine
You're likely using Java modules, so you either need to add jcalendar
to your module-info.java
file, or get rid of this file alltogether if you don't really need modules.
WindowBuilder not crashing everytime i try to use it. Auto generated code by windowbuilder