P
P
Pavel Subbotin2021-01-15 06:59:03
Java
Pavel Subbotin, 2021-01-15 06:59:03

How to create a button in JOGL?

How to create a button in JOGL? I tried to create it in the same way as in a regular application, but for some reason my button looks like this:
600112a21948b560070381.png
Also, because of it, the window with the 3d figure stops stretching.
Here is the code if needed:

public static void main(String[] args) {

        //getting the capabilities object of GL2 profile
        final GLProfile profile  = GLProfile.get(GLProfile.GL2 );
        GLCapabilities capabilities  = new GLCapabilities( profile );

        // The canvas
        final GLCanvas glcanvas = new GLCanvas(capabilities);
        BasicFrame l = new BasicFrame();
        glcanvas.addGLEventListener(l);
        glcanvas.setSize(400, 400);

        // creating frame
        final JFrame frame = new JFrame ("Rotating Triangle");

        // adding canvas to it
        frame.getContentPane().add( glcanvas );
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(frame.getContentPane() .getPreferredSize());
        frame.add(glcanvas);

        JButton btn = new JButton("Test");
        btn.setBackground(Color.white);
        btn.setBounds(0, 0, 50, 30);
        frame.add(btn);

        frame.setVisible( true );

        //Instantiating and Initiating Animator
        final FPSAnimator animator = new FPSAnimator(glcanvas, 300,true);
        animator.start();
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2017-05-03
@dimonchik2013

if all three are in the regexp, then it is written incorrectly,
this is also incorrect
regexp is needed for each field, i.e. phone1 regexp expression and phone2 regexp expression
otherwise it is better to set parentheses

R
Rastishka, 2017-05-04
@Rastishka

Bring phones to a single form of notation (remove parentheses, dashes, make it always start with +7###)
Throw out REGEXS, because with them a fullscan and without using an index
Add indexes to the fields town, age, phone1, phone2
Make a request:
* **
WHERE `town` BETWEEN 4 AND 14
AND `age` BETWEEN 64 AND 99
AND (phone1 LIKE '+7495%' OR phone1 LIKE '+7499%' OR phone1 LIKE '+7812%')
AND (phone2 LIKE '+ 7495%' OR phone2 LIKE '+7499%' OR phone2 LIKE '+7812%');
Of course, it won’t work for a highload, but with minimal effort you can speed up the request by 100-1000 times. =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question