Open a window when pressing button with dimensions set JAVA

0

I have a menu in my application / interface Java Swing , by clicking on the " Ayuda " button I want the help system to open. What happens is that I get very minuscule by default and it does not come out centered, I would like to declare some measures both wide and high so that it can be displayed correctly.

I leave you a image of what happens: link

Code:

private void lanzarAyuda(){
        try{
            //Carga el fichero de ayuda.
            File fichero = new File("sistema_ayuda" + File.separator + "helpset.hs");
            URL hsURL = fichero.toURI().toURL();

            //Crea el HelpSet.
            HelpSet helpset = new HelpSet(getClass().getClassLoader(), hsURL);
            HelpBroker hb = helpset.createHelpBroker();
            //Mostrar el sistema de ayuda al pulsar F1.
            hb.enableHelpOnButton(button_ayuda, "index", helpset);
            hb.enableHelpKey(getRootPane(), "index", helpset);
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    
asked by omaza1990 03.01.2017 в 11:00
source

1 answer

1

The HelpBroker class has a setSize and setLocation method:

  

void setLocation (java.awt.Point p)             Sets the position of the presentation.
  void setSize (java.awt.Dimension d)             Sets the size of the presentation.

For example, try

  

helpBroker.setSize (new Dimension (800,600));

     

helpBroker.setLocation (new Point (posX, posY));

More info

    
answered by 03.01.2017 / 11:52
source