Mercurial > hg > Applications > TreeVNC
view src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeSelectionPanel.java @ 406:0eea469c6349
Add ScreenChangeSelectionPanel
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 Nov 2015 15:44:53 +0900 |
parents | |
children | 7cd416d6a152 |
line wrap: on
line source
package jp.ac.u_ryukyu.treevnc; import com.glavsoft.rfb.protocol.ProtocolContext; import com.glavsoft.viewer.swing.SwingViewerWindow; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public class ScreenChangeSelectionPanel extends JFrame implements ActionListener, ItemListener { private JPanel panel = new JPanel(); private JButton button = new JButton("Share Screen"); private int counter; private Checkbox[] check = new Checkbox[20]; private CheckboxGroup ch = new CheckboxGroup(); private Container contentPane = getContentPane(); private double width = 750; private double height = 500; private SwingViewerWindow viewerWindow; private ProtocolContext context; public ScreenChangeSelectionPanel(SwingViewerWindow viewerWindow, ProtocolContext context) { this.context = context; this.viewerWindow = viewerWindow; setTitle("Select Share Screen"); setResizable(false); } public void setButton() { panel.add(button); button.addActionListener(this); contentPane.add(panel, BorderLayout.CENTER); } public void checkBox(String str) { if (counter == 0) check[counter] = new Checkbox(str, true, ch); else check[counter] = new Checkbox(str, false, ch); check[counter].addItemListener(this); panel.add(check[counter]); panel.setLayout(new GridLayout(counter + 2, 0)); panel.setLocation((int) width - 250, (int) height - 80); counter++; } @Override public void actionPerformed(ActionEvent e) { for (int i = 0; i < counter; i++) { if (check[i].getState()) { viewerWindow.screenChangeRequest(context, i); setVisible(false); } } } public void visible() { Point point = new Point(); point.setLocation(width - 250, height - 80); setLocation(point.getLocation()); pack(); setVisible(true); } @Override public void itemStateChanged(ItemEvent e) { } }