I am currently trying to code my program that uses a JFrame and JPanel so that if the user tries to re-size the Frame smaller than the Panel the program won't allow that to happen. I've been researching for a while now using and got it working a little bit with a ComponentListener however I need to code it using a user-defined exception. Below is the code I used for the ComponentListener. Could anyone give me advice on how to do this via a User-Defined exception?
Frame.addComponentListener(new ComponentAdapter()
{
public void componentResized(ComponentEvent e)
{
Frame.setSize(Math.min(800,
Frame.getWidth()),
Math.min(350,
Frame.getHeight()));
}
});