/** * <b>refreshWindow()</b></br> <i>Updates window boundaries, sets the current panel, and turns the * Window visible. A general method used to update things pertaining to the Window that the * WindowManager cares for.</i></br> * * @version Slap 0.1 */ public void refreshWindow() { LOG.setSubSection("Refresh"); if (CURRENT_PANEL != null) { WINDOW.repaint(); LOG.log("Current panel exists. Setting up information."); if (CURRENT_PANEL.getTrackProgress() == true) { LOG.log("Progress tracking turned on, setting next panel."); setTrackProgress(true); setNextPanel(CURRENT_PANEL.getNextPanelName()); } else { LOG.log("Progress tracking turned off."); setTrackProgress(false); } LOG.log("Setting current panel."); WINDOW.setCurrentPanel(CURRENT_PANEL); if (BOUND_HEIGHT != WINDOW.getBoundLength() || BOUND_WIDTH != WINDOW.getBoundWidth()) { LOG.log("Forcing window visiblity to false to update boundaries."); WINDOW.setVisible(false); LOG.log("Updating boundaries."); WINDOW.setBoundaries(BOUND_HEIGHT, BOUND_WIDTH); try { SwingUtilities.invokeAndWait( new Runnable() { @Override public void run() { WINDOW.updateBoundaries(); } }); } catch (Exception ex) { ex.printStackTrace(); } } LOG.log("Applying window attributes."); WINDOW.setTitle(TITLE); LOG.log("Forcing window visibility to true."); WINDOW.setVisible(true); LOG.log("Forcing window to move to centered position."); WINDOW.setLocationRelativeTo(null); LOG.log("Repainting window."); WINDOW.repaint(); } else { LOG.log("No current panel, window cannot be refreshed."); } LOG.useSubSection(false); }
protected void onUserDefinedTabAdded() { final Window window = new Window(); window.setTitle("Create your own tab"); window.setClosable(true); window.setPaddings(7); window.setCloseAction(Window.HIDE); window.add(new CreateUserDefinedTabForm(window)); window.show(); }
public static void main(String[] args) { Window window = new Window(1024, 768, false); window.setTitle("Hello OpenGL!"); window.setVisible(true); int vertexCount = 3; int floatSize = 4; FloatBuffer buffer = createFloatBuffer(vertexCount * 3 + vertexCount * 4); buffer.put(0).put(0.5f).put(0); buffer.put(1).put(0).put(0).put(1); buffer.put(-0.5f).put(-0.5f).put(0); buffer.put(0).put(1).put(0).put(1); buffer.put(0.5f).put(-0.5f).put(0); buffer.put(0).put(0).put(1).put(1); buffer.flip(); /*IntBuffer indices = ByteBuffer.allocateDirect(3 * 4).order(ByteOrder.nativeOrder()).asIntBuffer(); indices.put(0).put(1).put(2); indices.flip();*/ int vbo = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW); while (!window.isCloseRequested()) { window.pollEvents(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, vbo); glVertexPointer(3, GL_FLOAT, 7 * floatSize, 0); glColorPointer(4, GL_FLOAT, 7 * floatSize, 3 * floatSize); glDrawArrays(GL_TRIANGLES, 0, 3); window.swap(); window.sleep(16); } window.destroy(); }
void show() { if (window != null) { window.present(); return; } window = new Window(WindowType.TOPLEVEL); window.setTitle("Snark - Properties"); window.addListener((LifeCycleListener) this); Widget infoBox = create(); window.add(infoBox); infoBox.showAll(); window.showAll(); }