示例#1
0
 public CheckBox(Listener c, Point location, boolean initial) {
   call = c;
   this.location = location;
   checked = initial;
   if (checkedtex == null) {
     try {
       checkedtex =
           Texture.fromStream(
               CheckBox.class.getResourceAsStream(
                   "/nl/xupwup/WindowManager/resources/checkboxC.png"));
       uncheckedtex =
           Texture.fromStream(
               CheckBox.class.getResourceAsStream(
                   "/nl/xupwup/WindowManager/resources/checkboxU.png"));
     } catch (IOException ex) {
       Logger.getLogger(CheckBox.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
示例#2
0
 @Override
 public void draw() {
   Point p = getSize();
   glColor3f(1, 1, 1);
   glEnable(GL_TEXTURE_2D);
   if (checked) {
     checkedtex.bind();
   } else {
     uncheckedtex.bind();
   }
   glBegin(GL_QUADS);
   glTexCoord2f(0, 0);
   glVertex2f(0, 0);
   glTexCoord2f(0, 1);
   glVertex2f(0, p.y);
   glTexCoord2f(1, 1);
   glVertex2f(p.x, p.y);
   glTexCoord2f(1, 0);
   glVertex2f(p.x, 0);
   glEnd();
   glDisable(GL_TEXTURE_2D);
 }