/** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setIconImage(Toolkit.getDefaultToolkit().getImage("E:\\图片\\u=1829416607,2140971604&fm=21&gp=0.jpg")); frame.setType(Type.UTILITY); frame.setTitle("网络电影评论情感倾向性分类"); frame.setBounds(100, 100, 639, 412); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu mnNewMenu = new JMenu("数据集自动标注"); menuBar.add(mnNewMenu); JMenuItem mntmNewMenuItem_2 = new JMenuItem("自动标注"); mnNewMenu.add(mntmNewMenuItem_2); JMenu mnNewMenu_1 = new JMenu("情感分析"); menuBar.add(mnNewMenu_1); JMenuItem mntmNewMenuItem_3 = new JMenuItem("朴素贝叶斯算法"); mnNewMenu_1.add(mntmNewMenuItem_3); JMenuItem mntmNewMenuItem_4 = new JMenuItem("N-Gram算法"); mnNewMenu_1.add(mntmNewMenuItem_4); JMenuItem mntmNewMenuItem_5 = new JMenuItem("支持向量机"); mnNewMenu_1.add(mntmNewMenuItem_5); JMenu mnNewMenu_2 = new JMenu("关于"); menuBar.add(mnNewMenu_2); JMenuItem mntmNewMenuItem = new JMenuItem("作者"); mnNewMenu_2.add(mntmNewMenuItem); JMenuItem mntmNewMenuItem_1 = new JMenuItem("New menu item"); mnNewMenu_2.add(mntmNewMenuItem_1); }
private void enableDnd() { if (fileDrop != null) { fileDrop.setVisible(true); return; } fileDrop = new JFrame("Skin Drop"); fileDrop.setType(Type.UTILITY); fileDrop.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); fileDrop.setResizable(false); fileDrop.setTitle("Skin Drop"); fileDrop.setSize(256, 256); // fileDrop.setAlwaysOnTop(true); fileDrop.getContentPane().setLayout(null); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.GRAY)); panel.setBounds(10, 11, 230, 205); fileDrop.getContentPane().add(panel); JLabel txtInst = new JLabel("Drop skin file here"); txtInst.setHorizontalAlignment(SwingConstants.CENTER); txtInst.setVerticalAlignment(SwingConstants.CENTER); panel.add(txtInst); DropTarget dt = new DropTarget(); fileDrop.setDropTarget(dt); try { dt.addDropTargetListener((FileDropListener) files -> files.stream().findFirst().ifPresent(this::loadLocalFile)); fileDrop.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
/** * Initialize the contents of the frame. */ private void initialize() { frmPdfMakeronly = new JFrame(); frmPdfMakeronly.setType(Type.UTILITY); frmPdfMakeronly.setFont(new Font("Cambria", Font.PLAIN, 12)); frmPdfMakeronly.setTitle("Pdf maker (only for .java files )"); frmPdfMakeronly.setBounds(400, 400, 450, 310); frmPdfMakeronly.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmPdfMakeronly.getContentPane().setLayout( new BoxLayout(frmPdfMakeronly.getContentPane(), BoxLayout.X_AXIS)); panel = new JPanel(); frmPdfMakeronly.getContentPane().add(panel); panel.setLayout(new GridLayout(0, 1, 5, 5)); txtTypeYourName = new JTextField(); txtTypeYourName.setText("Enter your name"); txtTypeYourName.setToolTipText("type your name here"); panel.add(txtTypeYourName); txtTypeYourName.setColumns(5); txtTypeYourRoll = new JTextField(); txtTypeYourRoll.setText("Enter your roll no"); txtTypeYourRoll.setToolTipText("type your roll no here"); panel.add(txtTypeYourRoll); txtTypeYourRoll.setColumns(5); btnOk = new JButton("create PDF"); btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FileUtil.name = txtTypeYourName.getText(); FileUtil.rollno = txtTypeYourRoll.getText(); new FileUtil(); } }); panel.add(btnOk); }
protected void onSetRemoteSkin(MinecraftProfileTexture.Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { }
protected void onSetLocalSkin(MinecraftProfileTexture.Type type) { }
/** * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException * @throws UnsupportedLookAndFeelException */ private void initializeWindow() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); frame = new JFrame(); frame.setResizable(false); frame.setType(Type.NORMAL); frame.setBounds(100, 100, 640, 480); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0, 123 }; gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 68, 0 }; gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; frame.getContentPane().setLayout(gridBagLayout); inputLbl = new JLabel("Input: "); GridBagConstraints inputLblGBC = new GridBagConstraints(); inputLblGBC.insets = new Insets(5, 5, 5, 5); inputLblGBC.anchor = GridBagConstraints.LINE_START; inputLblGBC.gridx = 0; inputLblGBC.gridy = 1; frame.getContentPane().add(inputLbl, inputLblGBC); inputBtn = new JButton("Change"); GridBagConstraints inputBtnGBC = new GridBagConstraints(); inputBtnGBC.insets = new Insets(5, 5, 5, 5); inputBtnGBC.gridx = 1; inputBtnGBC.gridy = 1; frame.getContentPane().add(inputBtn, inputBtnGBC); compileBtn = new JButton("Compile"); GridBagConstraints compileBtnGBC = new GridBagConstraints(); compileBtnGBC.insets = new Insets(5, 5, 5, 5); compileBtnGBC.gridx = 1; compileBtnGBC.gridy = 2; compileBtnGBC.fill = GridBagConstraints.NONE; compileBtnGBC.anchor = GridBagConstraints.CENTER; frame.getContentPane().add(compileBtn, compileBtnGBC); outputLbl = new JLabel("Output: "); GridBagConstraints outputLblGBC = new GridBagConstraints(); outputLblGBC.insets = new Insets(5, 5, 5, 5); outputLblGBC.anchor = GridBagConstraints.LINE_START; outputLblGBC.gridx = 0; outputLblGBC.gridy = 3; frame.getContentPane().add(outputLbl, outputLblGBC); outputBtn = new JButton("Change"); GridBagConstraints outputBtnGBC = new GridBagConstraints(); outputBtnGBC.insets = new Insets(5, 5, 5, 5); outputBtnGBC.gridx = 1; outputBtnGBC.gridy = 3; frame.getContentPane().add(outputBtn, outputBtnGBC); outputPane = new JScrollPane(); GridBagConstraints outputPaneGBC = new GridBagConstraints(); outputPaneGBC.gridwidth = 2; outputPaneGBC.insets = new Insets(5, 5, 5, 5); outputPaneGBC.fill = GridBagConstraints.BOTH; outputPaneGBC.gridx = 0; outputPaneGBC.gridy = 4; frame.getContentPane().add(outputPane, outputPaneGBC); outputTA = new JTextArea(10, 79); outputTA.setFont(new Font("monospaced", Font.PLAIN, 12)); outputTA.setTabSize(TAB_SIZE); outputTA.setEditable(false); outputPane.setViewportView(outputTA); frame.pack(); }
/** * Construct a new window (a NEWT window specifically) * * @param width * @param height * @return */ private void createWindowImp(CreateWindowMessage message) { RenderGLListener listener = new RenderGLListener(); final RenderWindow window = new RenderWindow(message.x, message.y, message.width, message.height, message.title, message.name, sharedContext, caps, listener, message.icon, message.windowID, message.viewID, message.listener); listener.setWindow(window); Camera camera = new Camera(Math.PI/3.0, 1, 0.1, 1000); synchronized (openWindows) { openWindows.put(message.windowID, window); cameras.put(message.windowID, camera); } window.getGLWindowRef().setAnimator(this); GLWindowListener wl = new GLWindowListener(window.getWindowID()); window.getGLWindowRef().addWindowListener(wl); window.getAWTFrameRef().addComponentListener(wl); window.getGLWindowRef().addMouseListener(new MouseHandler(window, message.listener)); window.getGLWindowRef().addKeyListener(message.listener); window.getAWTFrameRef().setType(Type.UTILITY); window.getAWTFrameRef().setAutoRequestFocus(false); EventQueue.invokeLater(new Runnable() { @Override public void run() { window.getAWTFrameRef().setVisible(true); } }); queueRedraw(); }
/** * @param args the command line arguments */ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception e) { } JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // frame.h frame.setType(javax.swing.JFrame.Type.UTILITY); frame.setUndecorated(true); // frame.setFocusableWindowState(false); frame.setFocusable(false); frame.setAlwaysOnTop(true); JApplet applet = new TimeManagementApplication(); applet.init(); frame.setContentPane(applet.getContentPane()); frame.pack(); frame.setSize(GlobalSetting.FORM_WIDTH, GlobalSetting.FORM_HEIGHT); // frame.setLocationRelativeTo(null); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice defaultScreen = ge.getDefaultScreenDevice(); Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds(); int x = (int) rect.getMaxX() - frame.getWidth(); int y = (int) rect.getMaxY() - frame.getHeight(); Logger.getLogger(TimeManagementApplication.class.getName()).log(Level.INFO, "Setting Height and Width:\n\tHeight: " + y + "\n\tWidth: "+ x); frame.setVisible(true); applet.start(); } }); }
public FrameConnection(Image icon) { super("Royal Spades - Connect to Server"); setType(Type.POPUP); setResizable(false); setIconImage(icon); setSize(new Dimension(370, 140)); SpringLayout springLayout = new SpringLayout(); getContentPane().setLayout(springLayout); JLabel lblPleaseInsertAn = new JLabel("<html><center>Please insert an Ace of Spades URL to the text field below to<br> connect, then click 'connect'.</center></html>"); lblPleaseInsertAn.setHorizontalAlignment(SwingConstants.CENTER); springLayout.putConstraint(SpringLayout.NORTH, lblPleaseInsertAn, 10, SpringLayout.NORTH, getContentPane()); springLayout.putConstraint(SpringLayout.WEST, lblPleaseInsertAn, 10, SpringLayout.WEST, getContentPane()); getContentPane().add(lblPleaseInsertAn); textField = new JTextField(); springLayout.putConstraint(SpringLayout.NORTH, textField, 6, SpringLayout.SOUTH, lblPleaseInsertAn); springLayout.putConstraint(SpringLayout.EAST, lblPleaseInsertAn, 0, SpringLayout.EAST, textField); springLayout.putConstraint(SpringLayout.WEST, textField, 10, SpringLayout.WEST, getContentPane()); springLayout.putConstraint(SpringLayout.EAST, textField, 354, SpringLayout.WEST, getContentPane()); getContentPane().add(textField); textField.setColumns(10); JButton btnCancel = new JButton("Cancel"); btnCancel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { setVisible(false); } }); springLayout.putConstraint(SpringLayout.SOUTH, btnCancel, -10, SpringLayout.SOUTH, getContentPane()); springLayout.putConstraint(SpringLayout.EAST, btnCancel, -10, SpringLayout.EAST, getContentPane()); getContentPane().add(btnCancel); JButton btnConnect = new JButton("Connect"); springLayout.putConstraint(SpringLayout.NORTH, btnConnect, 0, SpringLayout.NORTH, btnCancel); springLayout.putConstraint(SpringLayout.EAST, btnConnect, -6, SpringLayout.WEST, btnCancel); btnConnect.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { String u = textField.getText(); if(!u.contains("aos://")) { textField.setForeground(Color.RED); } else { textField.setForeground(Color.black); Main.connectToServer(textField.getText()); setVisible(false); } } }); getContentPane().add(btnConnect); }