当前位置: 首页>>代码示例>>Java>>正文


Java JApplet类代码示例

本文整理汇总了Java中javax.swing.JApplet的典型用法代码示例。如果您正苦于以下问题:Java JApplet类的具体用法?Java JApplet怎么用?Java JApplet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JApplet类属于javax.swing包,在下文中一共展示了JApplet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLayeredPane

import javax.swing.JApplet; //导入依赖的package包/类
private Component getLayeredPane() {
	Container parent = null;
	if (this.owner != null) {
		parent = this.owner instanceof Container ? (Container) this.owner : this.owner.getParent();
	}
	for (Container p = parent; p != null; p = p.getParent()) {
		if (p instanceof JRootPane) {
			if (p.getParent() instanceof JInternalFrame) {
				continue;
			}
			parent = ((JRootPane) p).getLayeredPane();
		} else if (p instanceof Window) {
			if (parent == null) {
				parent = p;
			}
			break;
		} else if (p instanceof JApplet) {
			break;
		}
	}
	return parent;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:RoundedRectanglePopup.java

示例2: NonOpaqueJAppletFrame

import javax.swing.JApplet; //导入依赖的package包/类
NonOpaqueJAppletFrame() {
    super("NonOpaque Swing JAppletFrame");
    JApplet ja = new JApplet() {
        public void paint(Graphics g) {
            super.paint(g);
            System.err.println("JAppletFrame paint called");
        }
    };
    p = new JPanel() {
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            render(g, getWidth(), getHeight(), true);
            g.setColor(Color.red);
            g.drawString("Non-Opaque Swing JFrame", 10, 15);
        }
    };
    p.setDoubleBuffered(false);
    p.setOpaque(false);
    ja.add(p);
    add(ja);
    setUndecorated(true);
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:23,代码来源:TSFrame.java

示例3: getPopup

import javax.swing.JApplet; //导入依赖的package包/类
@Override
public Popup getPopup(Component owner, Component contents, int x, int y)
		throws IllegalArgumentException {
	Component[] hierarchy = getHierarchy(owner);
	for(int a = hierarchy.length-1; a>=0; a--) {
		if(hierarchy[a] instanceof JApplet && 
				contents instanceof JComponent) {
			return new AppletPopup( (JApplet)hierarchy[a], owner, (JComponent)contents, x, y);
			
		/* Unfortunately we can't simply check against a java.awt.Frame,
		 * because applets can be embedded in a 
		 * sun.plugin2.main.client.PluginEmbeddedFrame.
		 */
		//} else if(hierarchy[a] instanceof Frame) {
		} else if(hierarchy[a] instanceof JFrame) {
			return oldFactory.getPopup(owner, contents, x, y);
		}
	}
	return oldFactory.getPopup(owner, contents, x, y);
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:21,代码来源:AppletPopupFactory.java

示例4: run

import javax.swing.JApplet; //导入依赖的package包/类
public void run() {

   try {
      Class cls = Class.forName(loadAppletName);
      JApplet app = (JApplet)cls.newInstance();
      app.setStub((AppletStub)this);
      app.init();
      
     
      getContentPane().add("Center", app);
      loadApplet = app;
      validate();
     
      if(isStarted) {
     	 loadApplet.start();
      }
      validate();
   } catch (Throwable e) {
  	 loadApplet = null;
      AppletLogger.showError("Exception:", e);
      
      e.printStackTrace();
      validate();
   }
   System.out.println("Thread end");
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:27,代码来源:AppletLaunch.java

示例5: run

import javax.swing.JApplet; //导入依赖的package包/类
public void run() {

   try {
      Class cls = Class.forName(loadAppletName);
      JApplet app = (JApplet)cls.newInstance();
      app.setStub((AppletStub)this);
      app.init();
      
     
      getContentPane().add("Center", app);
      loadApplet = app;
      validate();
     
      if(isStarted) {
     	 loadApplet.start();
      }
      validate();
   } catch (Throwable e) {
  	 loadApplet = null;
      AppletLogger.showError("Exception:", e);
      
      e.printStackTrace();
      validate();
   }
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:26,代码来源:AppletLaunch.java

示例6: main

import javax.swing.JApplet; //导入依赖的package包/类
/**
 * @param args
 * @throws IOException 
 */
public static void main(String[] args) throws IOException {
	// TODO Auto-generated method stub
	


      JFrame f = new JFrame("Line");
      f.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      });
      
      JApplet applet = new Gynfont();
      f.getContentPane().add("Center", applet);
      applet.init();
      f.pack();
      f.setSize(new Dimension(800, 100));
      f.setVisible(true);
	
}
 
开发者ID:kmatylla,项目名称:gynvaels-fanclub,代码行数:25,代码来源:Gynfont.java

示例7: showMensagem

import javax.swing.JApplet; //导入依赖的package包/类
/**
   * 
* Exibe uma caixa de dialogo com uma mensagem.
* 
   * @param applet
   * @param mensagem -> String com a mensagem a ser exibida
   * @param tipo -> Tipo da mensagem, sendo: 0 = Informacao, 1 = Alerta e 2 = Erro 
   */
  public static void showMensagem(JApplet applet, String mensagem, int tipo) {
  	
      String[] botao = new String[]{""};
      botao[0]= "Fechar";
      String Titulo;
      int tipoMsg;
      switch (tipo) {
      	case 0:  Titulo= "Informa��o do Sistema."; tipoMsg=JOptionPane.INFORMATION_MESSAGE;  break;
      	case 1:  Titulo= "Alerta do Sistema!"; tipoMsg=JOptionPane.WARNING_MESSAGE;  break;
      	case 2:  Titulo= "Erro na Execu��o!"; tipoMsg=JOptionPane.ERROR_MESSAGE;  break;
      	default: Titulo= "Informa��o do Sistema!"; tipoMsg=JOptionPane.INFORMATION_MESSAGE;  break;
  }                
      JOptionPane.showOptionDialog(applet,  
              mensagem,  
              Titulo,  
              JOptionPane.YES_OPTION,  
              tipoMsg,   
              null,  
              botao,
              botao[0]);
  	
  	//JOptionPane.showMessageDialog(applet, message, "Mensagem do Sistema",JOptionPane.NO_OPTION);    	
  }
 
开发者ID:esaito,项目名称:ExemplosDemoiselle,代码行数:32,代码来源:TabeliaoAppletUtil.java

示例8: Menu

import javax.swing.JApplet; //导入依赖的package包/类
public Menu(int w, int h, JApplet aplet)
{
    try 
    {
        bgImage = ImageIO.read(this.getClass().getClassLoader().getResource("resources/chessg.jpg"));
        bgImage =  bgImage.getScaledInstance(w, h, 1);
        startButton = ImageIO.read(this.getClass().getClassLoader().getResource("resources/startgame.png"));
        exitButton =ImageIO.read(this.getClass().getClassLoader().getResource("resources/exitgame.png"));
        playGame=  new Rectangle(100,100,100,50);
        exit = new Rectangle(100,200,90,50);
        frame=aplet;
        
    } 
    catch (IOException ex)
    {
        System.err.println(ex.toString());
    }
}
 
开发者ID:thesashi7,项目名称:SimpleChess,代码行数:19,代码来源:Menu.java

示例9: loadImage

import javax.swing.JApplet; //导入依赖的package包/类
/**
 * Loads an image from the application server from which a JApplet originates.  Stores
 * the the image in the image mapping with the parameter name as the key.
 * 
 * @param applet The JApplet
 * @param parameter Name of the parameter which specifies the relative path of the image
 */
protected void loadImage(JApplet applet, String parameter)
{
  String codeBase = applet.getCodeBase().toString();
  String path = applet.getParameter(parameter);

  if (path != null)
  {
    try
    {
      URL url = new URL(codeBase + path);
      BufferedImage image = ImageIO.read(url);

      images.put(parameter, image);
    }
    catch (Exception e)
    {
      //Unable to load image do nothing
    }
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:28,代码来源:StandardPolicy.java

示例10: init

import javax.swing.JApplet; //导入依赖的package包/类
public void init(JApplet a) {
	applet = a;
	
	size = applet.getSize();
	canvas = new Canvas();
	canvas.setSize(applet.getSize());
	applet.add(canvas);
	canvas.createBufferStrategy(2);
	
	canvas.addKeyListener(this);
	canvas.addMouseListener(this);
	canvas.addMouseMotionListener(this);
	canvas.addMouseWheelListener(this);
	canvas.setBackground(Color.black);
	canvas.setForeground(Color.white);
	
	frames = 0;
	start = 0;
	layers = new CopyOnWriteArrayList<>();
	
	initGame();
}
 
开发者ID:Dakror,项目名称:GameSetup,代码行数:23,代码来源:GameApplet.java

示例11: main

import javax.swing.JApplet; //导入依赖的package包/类
public static void main(String[] args) {
  SwingUtilities.invokeLater(() -> {
    JFrame frame = new JFrame("Swing FX Keyboard");
    frame.setResizable(false);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JApplet applet = new SwingDemo();
    applet.init();

    frame.setContentPane(applet.getContentPane());

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    applet.start();

  });
}
 
开发者ID:comtel2000,项目名称:fx-experience,代码行数:20,代码来源:SwingDemo.java

示例12: createMenus

import javax.swing.JApplet; //导入依赖的package包/类
private void createMenus() {
	menuBar = new JMenuBar();
	createFileMenu();
	createDisplayMenu();
	createAnimationMenu();
	if (container instanceof JFrame) {
		((JFrame) container).setJMenuBar(menuBar);
	} else if (container instanceof JApplet) {
		((JApplet) container).setJMenuBar(menuBar);
	}
}
 
开发者ID:moment-of-peace,项目名称:AI-RRT-Motion-Planning,代码行数:12,代码来源:Visualiser.java

示例13: ActivityMonitorTest

import javax.swing.JApplet; //导入依赖的package包/类
/** Creates new form ActivityMonitorTest */
public ActivityMonitorTest(JApplet applet) {
    initComponents();
    this.applet = applet;
    setSize(800,300);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(applet,BorderLayout.CENTER);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:ActivityMonitorTest.java

示例14: main

import javax.swing.JApplet; //导入依赖的package包/类
/**
 * @param args the command line arguments
 */
public static void main(String args[]) {
    JApplet applet = new DVSActApplet();
    JFrame frame = new ActivityMonitorTest(applet);
    applet.init();
    applet.start();
    frame.setVisible(true);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:11,代码来源:ActivityMonitorTest.java

示例15: main

import javax.swing.JApplet; //导入依赖的package包/类
/**
 * For testing in JFrame
 * @param args the command line arguments
 */
public static void main(String args[]) {
    JApplet applet = new ClockApplet();
    JFrame frame = new ActivityMonitorTest(applet);
    applet.init();
    applet.start();
    frame.setVisible(true);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:ClockApplet.java


注:本文中的javax.swing.JApplet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。