#The import javax.swing.JOptionPane cannot be resolved
28 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @foggy swallow! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
int response = JOptionPane.showConfirmDialog(null,responseMsg, "Confirmation de reservation", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE);
``` Here's where I'm calling it
import javax.swing.AbstractListModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
Here's all my imports, everything is working perfectly fine, except for JOptionPane
Huh, that's very strange
Doesnt work for me either
In java 8, works perfectly, upgrade to 17: breaks
Yeah, same thing im facing
Really weird
But i need it in java 17 💀
Apparently, JOptionPane is deprecated starting from java 17
Starting from Java 17, the JOptionPane class has been marked as deprecated, which means that it is no longer recommended for use in new code. Instead, you should use alternative classes from the javax.swing package or other libraries.
@foggy swallow in your module-info.java, add requires java.desktop;
that fixed it for me
public void handleValidateEvent() {
//Display confirmation window using JOptionPane
}
``` I love university
It's already in there
module tpcommunpartieihmdonnee {
requires java.desktop;
requires com.github.lgooddatepicker;
}
you saved the file?
It's been in there since the start
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
make sure to close the post if you're done.