/** * Set the background image to be used instead of a plain color background <br> * The window will resize to accommodate the image. * * @param image */ public void setBackground(PImage image) { papplet.noLoop(); papplet.bkImage = null; super.setResizable(true); papplet.resize(image.width, image.height); papplet.bkImage = image; papplet.appWidth = image.width; papplet.appHeight = image.height; papplet.setPreferredSize(new Dimension(papplet.appWidth, papplet.appHeight)); papplet.setMinimumSize(new Dimension(papplet.appWidth, papplet.appHeight)); pack(); super.setResizable(false); papplet.loop(); }
public static void Field1(){ fieldT.Label(); fieldT.panel(); f1.setSize(400, 400); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); // 화면 픽셀 계산 Dimension frm = f1.getSize();//창 크기 계산 int xpos = (int)(screen.getWidth() / 2 - frm.getWidth() / 2); // 창 중앙 위치 계산 int ypos = (int)(screen.getHeight() / 2 - frm.getHeight() / 2); f1.setLayout(new GridLayout(4, 4));// 프레임 레이아웃 f1.setBackground(Color.cyan); //프레임 배경 f1.addWindowListener(new WEventHandler()); f1.addKeyListener(new KEventHandler()); f1.setResizable(false); for(int i =0;i<4;i++){ for(int j=0;j<4;j++){ f1.add(p[i][j]); } } f1.setLocation(xpos, ypos); f1.setVisible(true); }
// set the frame on the center of bildschirm private static void setFrameCenter(Frame f, boolean flag) { // f.getToolkit(); // Dimension screen=f.getToolkit().getDefaultToolkit().getScreenSize();//获取屏幕尺寸对象 Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); // 获取屏幕尺寸对象 Dimension myframe = f.getSize(); // 获取当前窗体的尺寸对象 int w = (screen.width - myframe.width) / 2; // 水平位置 int h = (screen.height - myframe.width) / 2; // 垂直位置 f.setLocation(w, h); f.setResizable(flag); }
public void setResizable(boolean b) { if (f != null) { f.setResizable(b); } else if (d != null) { d.setResizable(b); } else if (jif != null) { jif.setResizable(b); } else { throw new IllegalStateException(); } }
public static void main(String[] args) { GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); frame = new Frame(displayDevice.getDefaultConfiguration()); frame.setBackground(new Color(0xCC, 0xCC, 0xCC)); frame.setTitle("TestBug735Inv0AppletAWT"); try { Class<?> c = Thread.currentThread() .getContextClassLoader() .loadClass(Bug735Inv0AppletAWT.class.getName()); applet = (Bug735Inv0AppletAWT) c.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } frame.setLayout(null); frame.add(applet); frame.pack(); frame.setResizable(false); applet.init(); Insets insets = frame.getInsets(); int windowW = applet.width + insets.left + insets.right; int windowH = applet.height + insets.top + insets.bottom; frame.setSize(windowW, windowH); Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds(); frame.setLocation( screenRect.x + (screenRect.width - applet.width) / 2, screenRect.y + (screenRect.height - applet.height) / 2); int usableWindowH = windowH - insets.top - insets.bottom; applet.setBounds( (windowW - applet.width) / 2, insets.top + (usableWindowH - applet.height) / 2, applet.width, applet.height); // This allows to close the frame. frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); applet.initGL(); frame.setVisible(true); applet.start(); }
/** Prepare the window that shall show the openGL content. */ private void initWindow() { IllarionLookAndFeel.setupLookAndFeel(); // create canvas that shall show the openGL content display = Graphics.getInstance().getRenderDisplay(); display.getRenderArea().setBackground(Color.red); configChanged(IllaClient.getCfg(), CFG_RESOLUTION); final Component displayParent = display.getRenderArea(); displayParent.setBackground(Color.green); displayParent.setVisible(true); // set up the window settings displayFrame = new Frame(); displayFrame.setLayout(new BorderLayout(0, 0)); displayFrame.setTitle(IllaClient.getVersionText()); displayFrame.setBackground(Color.black); setIcon(displayFrame); displayFrame.addWindowListener(new ClientWindowListener()); displayFrame.setResizable(false); displayFrame.setFocusable(false); displayFrame.setFocusableWindowState(true); displayFrame.setFocusTraversalKeysEnabled(false); displayParent.setFocusable(true); displayParent.setFocusTraversalKeysEnabled(false); // add the canvas to the window and make the canvas the openGL render // target. displayFrame.add(displayParent, BorderLayout.CENTER); displayFrame.pack(); displayFrame.setLocationRelativeTo(null); displayFrame.setVisible(true); displayParent.requestFocusInWindow(); final RenderDisplay usedDisplay = display; Graphics.getInstance() .getRenderManager() .addTask( new RenderTask() { @Override public boolean render(final int delta) { usedDisplay.startRendering(); return false; } }); }
public void appletDragStarted() { isPoppedOut = true; updatePopOutButton(); Container container = this.getParent(); while (container != null) { if (container instanceof Frame) { Frame frame = (Frame) container; frame.setResizable(true); frame.setUndecorated(false); return; } container = container.getParent(); } }
public static void main(String[] args) { Frame frame = new Frame("Tetris"); Tetris tetris = new Tetris(); frame.add(tetris); tetris.init(); tetris.start(); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setSize(489, 441); frame.setResizable(false); frame.setVisible(true); }
public static void main(String[] args) { final StartMenu startMenu = new StartMenu(layout, GameApplet.WIDTH / 2, GameApplet.HEIGHT / 2); Frame frame = new Frame("Island Overlord"); frame.add(startMenu); frame.pack(); frame.setLocationRelativeTo(null); frame.setResizable(true); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { startMenu.stop(); System.exit(0); } }); frame.setVisible(true); startMenu.start(); }
public static void main(String[] args) { Window game = new Window(); Frame frame = new Frame(); frame.setTitle("Défis 28/10/2015"); frame.setResizable(false); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { game.stop(); } }); frame.add(game); frame.pack(); frame.setLocationRelativeTo(null); game.start(); frame.setVisible(true); }
public static void main(String[] args) { final GLCanvas canvas = new GLCanvas(); final Frame frame = new Frame("Jogl Quad drawing"); final Animator animator = new Animator(canvas); canvas.addGLEventListener(new Test()); frame.add(canvas); frame.setSize(640, 480); frame.setResizable(false); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { animator.stop(); frame.dispose(); System.exit(0); } }); frame.setVisible(true); animator.start(); canvas.requestFocus(); }
public static void main(String[] args) { final Frame mainFrame = new Frame(); mainFrame.setSize(800, 400); final Sidecraft sideCraft = new Sidecraft(); mainFrame.add(sideCraft); mainFrame.setVisible(true); mainFrame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent event) { mainFrame.dispose(); } public void windowClosed(WindowEvent event) { sideCraft.stop(); System.exit(0); } }); mainFrame.setTitle("Sidecraft"); mainFrame.setResizable(false); sideCraft.init(); sideCraft.start(); }
void init() { mainFrame = new Frame(); mainFrame.setBounds(400, 500, 800, 600); mainFrame.setLayout(new FlowLayout()); mainFrame.setResizable(false); upPanel = new Panel(); downPanel = new Panel(); addressTextField = new TextField(75); gotoButton = new Button("转到"); contentTextArea = new TextArea(30, 82); upPanel.add(addressTextField); upPanel.add(gotoButton); downPanel.add(contentTextArea); mainFrame.add(upPanel); mainFrame.add(downPanel); addEvent(); mainFrame.setVisible(true); }
public void run(String arg) { GenericDialog gd = new GenericDialog("Options"); double sfreq = 20000.0; gd.addNumericField("Sampling Frequency?", sfreq, 1, 10, null); String[] psfchoice = {"3D Gaussian", "Gaus-Lorentz^2", "2D Gaussian"}; gd.addChoice("PSF Type?", psfchoice, psfchoice[0]); String[] filetypechoice = { "Confocor 3 raw", "Short binary trajectory", "PlotWindow trajectory", "Ascii Text File" }; gd.addChoice("File Type?", filetypechoice, filetypechoice[0]); boolean ch2green = true; gd.addCheckbox("Ch2 is green?", ch2green); gd.showDialog(); if (gd.wasCanceled()) { return; } sfreq = gd.getNextNumber(); int psfflag = gd.getNextChoiceIndex(); int fileflag = gd.getNextChoiceIndex(); ch2green = gd.getNextBoolean(); int nfiles = 0; Object[] histograms = null; int xmax = 0; int ymax = 0; String[] names = null; if (fileflag < 2) { jdataio ioclass = new jdataio(); File[] filearray = ioclass.openfiles(OpenDialog.getDefaultDirectory(), IJ.getInstance()); if (filearray.length == 0) { return; } String dir = filearray[0].getAbsolutePath(); int sepindex = dir.lastIndexOf(File.separator); String newdir = dir.substring(0, sepindex + 1); OpenDialog.setDefaultDirectory(newdir); nfiles = filearray.length / 2; if (nfiles > 25) { nfiles = 25; } histograms = new Object[nfiles]; names = organize_c3_files(filearray); for (int i = 0; i < nfiles; i++) { try { int length1 = (int) (((double) filearray[2 * i].length() - 128.0) / 4.0); int length2 = (int) (((double) filearray[2 * i + 1].length() - 128.0) / 4.0); int length3 = (int) (((double) filearray[2 * i].length()) / 2.0); int length4 = (int) (((double) filearray[2 * i + 1].length()) / 2.0); InputStream instream = new BufferedInputStream(new FileInputStream(filearray[2 * i])); InputStream instream2 = new BufferedInputStream(new FileInputStream(filearray[2 * i + 1])); if (fileflag == 0) { int[] pmdata = new int[length1]; int[] pmdata2 = new int[length2]; if (!ioclass.skipstreambytes(instream, 128)) { showioerror(); instream.close(); return; } if (!ioclass.skipstreambytes(instream2, 128)) { showioerror(); instream2.close(); return; } if (!ioclass.readintelintfile(instream, length1, pmdata)) { showioerror(); instream.close(); return; } if (!ioclass.readintelintfile(instream2, length2, pmdata2)) { showioerror(); instream2.close(); return; } if (ch2green) { histograms[i] = (new pmodeconvert()).pm2pch(pmdata2, pmdata, sfreq, 20000000); } else { histograms[i] = (new pmodeconvert()).pm2pch(pmdata, pmdata2, sfreq, 20000000); } } else { float[] tmdata = new float[length3]; float[] tmdata2 = new float[length4]; if (!ioclass.readintelshortfile(instream, length3, tmdata)) { showioerror(); instream.close(); return; } if (!ioclass.readintelshortfile(instream2, length4, tmdata2)) { showioerror(); instream2.close(); return; } if (ch2green) { histograms[i] = (new pmodeconvert()).create_2Dhistogram(tmdata2, tmdata); } else { histograms[i] = (new pmodeconvert()).create_2Dhistogram(tmdata, tmdata2); } } if (((float[][]) histograms[i]).length > xmax) { xmax = ((float[][]) histograms[i]).length; } if (((float[][]) histograms[i])[0].length > ymax) { ymax = ((float[][]) histograms[i])[0].length; } instream.close(); instream2.close(); } catch (IOException e) { showioerror(); return; } } } else { if (fileflag == 2) { ImageWindow iw = WindowManager.getCurrentWindow(); float[][] trajectories = (float[][]) jutils.runPW4VoidMethod(iw, "getYValues"); float[][] tempxvals = (float[][]) jutils.runPW4VoidMethod(iw, "getXValues"); sfreq = 1.0 / ((double) tempxvals[0][1]); nfiles = trajectories.length / 2; if (nfiles > 25) { nfiles = 25; } names = new String[nfiles + 1]; names[nfiles] = "avg"; histograms = new Object[nfiles]; for (int i = 0; i < nfiles; i++) { names[i] = "trajectory " + (i + 1); if (ch2green) { histograms[i] = (new pmodeconvert()) .create_2Dhistogram(trajectories[2 * i + 1], trajectories[2 * i]); } else { histograms[i] = (new pmodeconvert()) .create_2Dhistogram(trajectories[2 * i], trajectories[2 * i + 1]); } if (((float[][]) histograms[i]).length > xmax) { xmax = ((float[][]) histograms[i]).length; } if (((float[][]) histograms[i])[0].length > ymax) { ymax = ((float[][]) histograms[i])[0].length; } } } else { // here we read tab delimited lines from files jdataio ioclass = new jdataio(); File[] filearray = ioclass.openfiles(OpenDialog.getDefaultDirectory(), IJ.getInstance()); if (filearray.length == 0) { return; } String dir = filearray[0].getAbsolutePath(); int sepindex = dir.lastIndexOf(File.separator); String newdir = dir.substring(0, sepindex + 1); OpenDialog.setDefaultDirectory(newdir); nfiles = filearray.length; if (nfiles > 25) { nfiles = 25; } histograms = new Object[nfiles]; names = new String[nfiles + 1]; names[nfiles] = "avg"; for (int i = 0; i < nfiles; i++) { try { names[i] = filearray[i].getName(); BufferedReader d = new BufferedReader(new FileReader(filearray[i])); String[] lines = new String[256]; int counter = 0; do { lines[counter] = d.readLine(); counter++; } while ((lines[counter - 1] != null && lines[counter - 1] != "") && counter < 256); int numcolumns = 0; for (int j = 0; j < counter - 1; j++) { int temp = getncolumns(lines[j]); if (temp > numcolumns) { numcolumns = temp; } } float[][] temphist2 = null; if (ch2green) { temphist2 = new float[numcolumns][counter - 1]; } else { temphist2 = new float[counter - 1][numcolumns]; } for (int k = 0; k < counter - 1; k++) { float[] temp = tab_delim2float(lines[k]); for (int j = 0; j < numcolumns; j++) { if (ch2green) { temphist2[j][k] = temp[j]; } else { temphist2[k][j] = temp[j]; } } } histograms[i] = temphist2; d.close(); } catch (IOException e) { showioerror(); return; } } for (int i = 0; i < nfiles; i++) { if (((float[][]) histograms[i]).length > xmax) { xmax = ((float[][]) histograms[i]).length; } if (((float[][]) histograms[i])[0].length > ymax) { ymax = ((float[][]) histograms[i])[0].length; } } } } // note that here x is green and y is red float[][][] pch = new float[nfiles][xmax][ymax]; for (int i = 0; i < nfiles; i++) { for (int j = 0; j < ((float[][]) histograms[i]).length; j++) { for (int k = 0; k < ((float[][]) histograms[i])[j].length; k++) { pch[i][j][k] = ((float[][]) histograms[i])[j][k]; } } } final PCH2DFitWindow cw = new PCH2DFitWindow(); cw.init(names, pch, psfflag); final Frame f = new Frame("PCH 2D Analysis"); f.setLocation(10, 10); f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { f.dispose(); } }); f.add(cw); f.pack(); f.setResizable(false); Insets ins = f.getInsets(); cw.totalSize.height = PCH2DFitWindow.H + ins.bottom + ins.top + 65; cw.totalSize.width = PCH2DFitWindow.WR + ins.left + ins.right; f.setSize(cw.totalSize); f.setVisible(true); cw.requestFocus(); }
package edu.gordon.physical;
@Override public void init() { setSize(800, 480); setBackground(Color.WHITE); setFocusable(true); addKeyListener(this); Frame frame = (Frame) this.getParent().getParent(); frame.setTitle("Q-Bot Alpha"); frame.setResizable(false); try { base = getDocumentBase(); } catch (Exception e) { // TODO: handle exception } // Image Setups character = getImage(base, "data/character.png"); arrowRobot = getImage(base, "data/ArrowRobot.png"); character2 = getImage(base, "data/character2.png"); character3 = getImage(base, "data/character3.png"); characterDown = getImage(base, "data/down.png"); characterJumped = getImage(base, "data/jumped.png"); heliboy = getImage(base, "data/heliboy.png"); heliboy2 = getImage(base, "data/heliboy2.png"); heliboy3 = getImage(base, "data/heliboy3.png"); heliboy4 = getImage(base, "data/heliboy4.png"); heliboy5 = getImage(base, "data/heliboy5.png"); background = getImage(base, "data/background.png"); tiledirt = getImage(base, "data/tiledirt.png"); tilegrassTop = getImage(base, "data/tilegrasstop.png"); tilegrassBot = getImage(base, "data/tilegrassbot.png"); tilegrassLeft = getImage(base, "data/tilegrassleft.png"); tilegrassRight = getImage(base, "data/tilegrassright.png"); basket = getImage(base, "data/basket.jpg"); arrow = getImage(base, "data/smallArrow.png"); ballonImage = getImage(base, "data/ballon.jpg"); ballonBottomImage = getImage(base, "data/ballonBottom.png"); burstSound = getAudioClip(getDocumentBase(), "data/burst.wav"); collectSound = getAudioClip(getDocumentBase(), "data/collect.wav"); /*anim = new Animation(); anim.addFrame(character, 1250); anim.addFrame(character2, 50); anim.addFrame(character3, 50); anim.addFrame(character2, 50); hanim = new Animation(); hanim.addFrame(heliboy, 100); hanim.addFrame(heliboy2, 100); hanim.addFrame(heliboy3, 100); hanim.addFrame(heliboy4, 100); hanim.addFrame(heliboy5, 100); hanim.addFrame(heliboy4, 100); hanim.addFrame(heliboy3, 100); hanim.addFrame(heliboy2, 100);*/ // currentSprite = anim.getImage(); }
/** * Core stuff for GWindows ctor * * @param x * @param y * @param w * @param h * @param noFrame * @param mode */ private void windowCtorCore( PApplet theApplet, int x, int y, int w, int h, PImage image, boolean noFrame, String mode, String name) { // If this is the first control to be created then theAapplet must be the sketchApplet if (G4P.sketchApplet == null) G4P.sketchApplet = theApplet; app = theApplet; winName = name; if (mode == null || mode.equals("")) mode = PApplet.JAVA2D; papplet = new GWinApplet(mode); papplet.owner = this; papplet.frame = this; // So we can resize the frame to get the sketch canvas size reqd. papplet.frame.setResizable(true); // Now set the window width and height if (image == null) { papplet.appWidth = w; papplet.appHeight = h; } else { papplet.bkImage = image; papplet.appWidth = image.width; papplet.appHeight = image.height; } papplet.bkColor = papplet.color(180); // Set the papplet size preferences papplet.resize(papplet.appWidth, papplet.appHeight); papplet.setPreferredSize(new Dimension(papplet.appWidth, papplet.appHeight)); papplet.setMinimumSize(new Dimension(papplet.appWidth, papplet.appHeight)); // add the PApplet to the Frame setLayout(new BorderLayout()); add(papplet, BorderLayout.CENTER); // ensures that the animation thread is started and // that other internal variables are properly set. papplet.init(); // Set the sketch path to the same as the main PApplet object papplet.sketchPath = theApplet.sketchPath; // Pack the window, position it and make visible setUndecorated(noFrame); pack(); setLocation(x, y); setVisible(true); // Make the window always on top setOnTop(true); // Make sure we have some data even if not used data = new GWinData(); data.owner = this; // Not resizeable if we are using a back image super.setResizable(image == null); // Make sure G4P knows about this window G4P.addWindow(this); }
public static void main(String[] args) { cg1Canvas T = new cg1Canvas(300, 300); T.setColor(1.0f, 1.0f, 1.0f); T.clear(); float quad1x[] = new float[4]; float quad1y[] = new float[4]; quad1x[0] = 20; quad1x[1] = 20; quad1x[2] = 40; quad1x[3] = 40; quad1y[0] = 20; quad1y[1] = 40; quad1y[2] = 40; quad1y[3] = 20; float quad2x[] = new float[4]; float quad2y[] = new float[4]; quad2x[0] = 80; quad2x[1] = 80; quad2x[2] = 60; quad2x[3] = 60; quad2y[0] = 60; quad2y[1] = 100; quad2y[2] = 100; quad2y[3] = 60; float quad3x[] = new float[4]; float quad3y[] = new float[4]; quad3x[0] = 20; quad3x[1] = 50; quad3x[2] = 50; quad3x[3] = 20; quad3y[0] = 60; quad3y[1] = 60; quad3y[2] = 50; quad3y[3] = 50; float quad4x[] = new float[4]; float quad4y[] = new float[4]; quad4x[0] = 44; quad4x[1] = 60; quad4x[2] = 60; quad4x[3] = 44; quad4y[0] = 22; quad4y[1] = 22; quad4y[2] = 46; quad4y[3] = 46; float pent1x[] = new float[5]; float pent1y[] = new float[5]; pent1x[0] = 80; pent1x[1] = 90; pent1x[2] = 110; pent1x[3] = 100; pent1x[4] = 80; pent1y[0] = 20; pent1y[1] = 10; pent1y[2] = 20; pent1y[3] = 50; pent1y[4] = 40; float hept1x[] = new float[7]; float hept1y[] = new float[7]; hept1x[0] = 120; hept1x[1] = 140; hept1x[2] = 160; hept1x[3] = 160; hept1x[4] = 140; hept1x[5] = 120; hept1x[6] = 110; hept1y[0] = 70; hept1y[1] = 70; hept1y[2] = 80; hept1y[3] = 100; hept1y[4] = 110; hept1y[5] = 100; hept1y[6] = 90; float wx[] = new float[50]; float wy[] = new float[50]; int wl; /* * first polygon: entirely within region */ wl = 0; wl = T.clipPolygon(4, quad1x, quad1y, wx, wy, 10, 10, 50, 50); T.setColor(1.0f, 0.0f, 0.0f); /* red */ T.printLoop(4, quad1x, quad1y); T.printPoly(wl, wx, wy); /* * second polygon: entirely outside region */ wl = 0; wl = T.clipPolygon(4, quad2x, quad2y, wx, wy, 10, 10, 50, 50); /* shouldn't draw anything! */ if (wl > 0) { T.setColor(0.0f, 1.0f, 0.0f); /* green */ T.printLoop(4, quad2x, quad2y); T.printPoly(wl, wx, wy); } // /* * third polygon: halfway outside on left */ wl = 0; wl = T.clipPolygon(4, quad3x, quad3y, wx, wy, 30, 10, 70, 80); T.setColor(0.0f, 0.0f, 1.0f); /* blue */ T.printLoop(4, quad3x, quad3y); T.printPoly(wl, wx, wy); /* * fourth polygon: part outside on right */ wl = 0; wl = T.clipPolygon(4, quad4x, quad4y, wx, wy, 10, 10, 50, 50); T.setColor(1.0f, 0.0f, 1.0f); /* magenta */ T.printLoop(4, quad4x, quad4y); T.printPoly(wl, wx, wy); /* * fifth polygon: enclosing */ wl = 0; wl = T.clipPolygon(5, pent1x, pent1y, wx, wy, 90, 20, 100, 30); T.setColor(0.5f, 0.5f, 1.0f); /* reddish-greenish-blue ? */ T.printLoop(5, pent1x, pent1y); T.printPoly(wl, wx, wy); /* * sixth polygon: outside on left and bottom */ wl = 0; wl = T.clipPolygon(5, pent1x, pent1y, wx, wy, 90, 34, 120, 60); T.setColor(1.0f, 0.5f, 1.0f); /* red-greenish-blue ? */ T.printLoop(5, pent1x, pent1y); T.printPoly(wl, wx, wy); /* * seventh polygon: outside on top, right, and bottom */ wl = 0; wl = T.clipPolygon(7, hept1x, hept1y, wx, wy, 90, 80, 130, 110); T.setColor(0.0f, 0.0f, 0.0f); /* black */ T.printLoop(7, hept1x, hept1y); T.printPoly(wl, wx, wy); Frame f = new Frame("clip Test"); f.add("Center", T); f.pack(); f.setResizable(false); f.setVisible(true); }
/** * Determines whether the window is resizabale or not. <br> * This cannot be set to true if a background image is used. */ public void setResizable(boolean resizable) { if (resizable == false) super.setResizable(false); else { if (papplet.bkImage == null) super.setResizable(true); } }
RootWindow(Container container, Screen screen, Format[] format, Client c) { super(screen.rootId); rootwindow = container; client = c; screen.setRoot((Window) this); this.width = (short) (screen.width); this.height = (short) (screen.height); this.screen = screen; depth = screen.rootDepth; id = screen.rootId; type = DRAWABLE_WINDOW; x = y = 0; origin.x = 0; origin.y = 0; clss = (byte) InputOutput; for (int i = 0; i < format.length; i++) { if (format[i].depth == screen.rootDepth) { this.bitsPerPixel = format[i].bpp; } } setVisual(screen.rootVisual); setBackgroundIsPixel(); background.pixel = screen.white; setBorderIsPixel(); border.pixel = screen.black; borderWidth = 0; Resource.add(this); makeOptional(); attr &= ~(1 << 3); // cursorIsNone optional.cursor = Cursor.rootCursor; setColormap(screen.defaultColormap); // if(rootwindow instanceof JFrame){ // rootwindow.setSize(this.width+10, this.height+30); // ?? // } // else{ rootwindow.setSize(this.width, this.height); // } try { ddxwindow = (DDXWindow) (Window.dDXWindow.newInstance()); } catch (Exception e) { System.err.println(e); /*ddxwindow=new DDXWindowImp();*/ } ddxwindow.init(this); ddxwindow.setLocation(0, 0); if (rootwindow instanceof Frame) { // ((Frame)rootwindow).setLayout(null); ((Frame) rootwindow).setResizable(false); ((Frame) rootwindow).setMenuBar(null); ((Frame) rootwindow).add((java.awt.Component) ddxwindow); } else if (rootwindow instanceof Applet) { ((Applet) rootwindow).add((java.awt.Component) ddxwindow); } /* else if(rootwindow instanceof JFrame){ ((JFrame)rootwindow).getContentPane().setLayout(null); ((JFrame)rootwindow).setResizable(false); ((JFrame)rootwindow).setJMenuBar(null); ((JFrame)rootwindow).getContentPane().add((java.awt.Component)ddxwindow); } else if(rootwindow instanceof JWindow){ ((JWindow)rootwindow).getContentPane().setLayout(null); ((JWindow)rootwindow).getContentPane().add((java.awt.Component)ddxwindow); } else if (rootwindow instanceof JApplet){ ((JApplet)rootwindow).setJMenuBar(null); ((JApplet)rootwindow).getContentPane().add((java.awt.Component)ddxwindow); } */ else { rootwindow.add((java.awt.Component) ddxwindow); } if (screen.windowmode != WeirdX.InBrowser) { rootwindow.addNotify(); } else { rootwindow.setVisible(true); } ddxwindow.setVisible(true); { rootwindow.validate(); Insets insets = rootwindow.getInsets(); rootwindow.setSize( this.width + insets.left + insets.right, this.height + insets.top + insets.bottom); ddxwindow.setLocation(insets.left, insets.top); rootwindow.validate(); } ddxwindow.requestFocus(); Window.focus.win = id; Window.LOCK = rootwindow.getTreeLock(); Client.LOCK = rootwindow.getTreeLock(); Resource.LOCK = rootwindow.getTreeLock(); spriteTrace[0] = this; sprite.win = this; }