Java Code Examples for javax.swing.JButton#setBounds()

The following examples show how to use javax.swing.JButton#setBounds() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataPresentationModeChooserPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
private JButton applyShadeButtonFactory() {
        JButton applyShadeButton = new ET_JButton("Refit all data to shades.");
        applyShadeButton.setBounds(15, 68, 170, 20);

        applyShadeButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {

//                ((TripoliSessionRawDataView) sampleSessionDataView).getTripoliSession().applyMaskingArray();
                // nov 2015 update maskinginstance with shades
                MaskingSingleton.getInstance().shadeMask();
                ((TripoliSessionRawDataView) sampleSessionDataView).getTripoliSession().reFitAllFractions();

                // jan 2015 force refit after applying shade
                //see above ((TripoliSessionRawDataView) sampleSessionDataView).getTripoliSession().calculateSessionFitFunctionsForPrimaryStandard();

                ((AbstractRawDataView) sampleSessionDataView).refreshPanel(true, false);

            }
        });

        return applyShadeButton;
    }
 
Example 2
Source File: ConfigPanel.java    From dkpro-jwpl with Apache License 2.0 6 votes vote down vote up
private void createVerifyButton()
{

	verifyButton = new JButton("Verify Settings");
	verifyButton.setBounds(200, 310, 190, 25);

	verifyButton.addActionListener(new ActionListener()
	{
		@Override
		public void actionPerformed(final ActionEvent e)
		{
			controller.createConfigurationXML();
			repaint();
		}
	});

	this.add(verifyButton);
}
 
Example 3
Source File: Main.java    From KJController with Apache License 2.0 6 votes vote down vote up
/**
 * 开/关按钮
 */
private void initButton() {
    final JButton mBtn = new JButton("开启");
    mBtn.setBounds(10, 60, 190, 25);
    getContentPane().add(mBtn);
    mBtn.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            if (!btnIsStart) {
                start();
                mBtn.setText("关闭");
            } else {
                stop();
                mBtn.setText("开启");
            }
        }
    });
}
 
Example 4
Source File: AllFunctionsChoicePanel.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
private JButton buttonForODChoiceFactory(int pixelsFromTop, final String caption, final boolean setOD) {

        JButton ODChoiceButton = new ET_JButton(caption);
        ODChoiceButton.setFont(new Font("SansSerif", Font.PLAIN, 10));
        ODChoiceButton.setBounds(5, pixelsFromTop, 110, 20);
        ODChoiceButton.setMargin(new Insets(0, 0, 0, 0));
        ODChoiceButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                for (AbstractRawDataView rawDataModelView : rawDataModelViews) {
                    DataModelFitFunctionInterface rawRatioDataModel = (DataModelFitFunctionInterface) rawDataModelView.getDataModel();
                    if (meanOnly) {// case of downhole
                        ((RawRatioDataModel) rawRatioDataModel).setOverDispersionSelectedDownHole(setOD);
                    } else {
                        rawRatioDataModel.setOverDispersionSelected(setOD);
                    }
//                    try {
//                        ((FitFunctionDataInterface) rawDataModelView).updateFittedData(true);
//                    } catch (Exception e2) {
//                    }
                }

//                ((AbstractRawDataView) sampleSessionDataView).refreshPanel(true);
                for (int i = 0; i < rawDataModelViews.length; i++) {
                    rawDataModelViews[i].refreshPanel(false, false);
                }
                updateReportTable();
            }
        });

        return ODChoiceButton;
    }
 
Example 5
Source File: PinPadPanelImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private JButton createButton(String label, Font fntButton, Insets marginButton, Rectangle bounds, ActionListener listener) {
   JButton btnNumberOne = new JButton(label);
   btnNumberOne.setMargin(marginButton);
   btnNumberOne.setFont(fntButton);
   btnNumberOne.setBounds(bounds);
   btnNumberOne.addActionListener(listener);
   return btnNumberOne;
}
 
Example 6
Source File: PinPadPanelImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private JButton createButton(String label, Font fntButton, Insets marginButton, Rectangle bounds, ActionListener listener) {
   JButton btnNumberOne = new JButton(label);
   btnNumberOne.setMargin(marginButton);
   btnNumberOne.setFont(fntButton);
   btnNumberOne.setBounds(bounds);
   btnNumberOne.addActionListener(listener);
   return btnNumberOne;
}
 
Example 7
Source File: FractionInfoPanel.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
private JButton buttonForSelectAllFactory(int pixelsFromTop, final String caption) {
    JButton refitChoiceButton = new ET_JButton(caption);
    refitChoiceButton.setFont(new Font("SansSerif", Font.PLAIN, 11));
    refitChoiceButton.setBounds(70, pixelsFromTop, 88, 20);
    refitChoiceButton.addActionListener((ActionEvent ae) -> {
        tripoliFraction.toggleAllDataExceptShaded(true);
        rawDataModelView.repaintFraction();
        //((AbstractRawDataView) sampleSessionDataView).refreshPanel();
    });

    return refitChoiceButton;
}
 
Example 8
Source File: FilterPanel.java    From dkpro-jwpl with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize two buttons: SelectAll and UnselectAll
 */
private void initButtons()
{
	JButton selectAll = new JButton("Select all");
	selectAll.addActionListener(new ActionListener()
	{

		@Override
		public void actionPerformed(ActionEvent arg0)
		{
			for (int i = 0; i < 22; i++) {
				namespaces.getModel().setValueAt(new Boolean(true), i, 1);
			}

		}
	});
	selectAll.setBounds(380, 10, 120, 25);
	this.add(selectAll);

	JButton unselectAll = new JButton("Unselect all");

	unselectAll.addActionListener(new ActionListener()
	{

		@Override
		public void actionPerformed(ActionEvent e)
		{
			for (int i = 0; i < 22; i++) {
				namespaces.getModel().setValueAt(new Boolean(false), i, 1);
			}

		}
	});

	unselectAll.setBounds(380, 40, 120, 25);
	this.add(unselectAll);
}
 
Example 9
Source File: RefreshUrlPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JButton createButton1(String name, int x, int y) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	Dimension d = btn.getPreferredSize();
	btn.setBounds(x, y, d.width, d.height);
	// btn.addActionListener(this);
	return btn;
}
 
Example 10
Source File: AllFunctionsChoicePanel.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
private JButton buttonForFitFunctionFactory(int pixelsFromTop, final FitFunctionTypeEnum fitFunctionType) {

        JButton functionChoiceButton = new ET_JButton(fitFunctionType.getPrettyName());
        functionChoiceButton.setName(fitFunctionType.getName());
        functionChoiceButton.setFont(new Font("SansSerif", Font.PLAIN, 11));
        functionChoiceButton.setMargin(new Insets(0, 0, 0, 0));
        functionChoiceButton.setBounds(5, pixelsFromTop, 110, 20);

        functionChoiceButton.addActionListener((ActionEvent e) -> {
            for (AbstractRawDataView rawDataModelView : rawDataModelViews) {
                DataModelFitFunctionInterface rawRatioDataModel1 = (DataModelFitFunctionInterface) rawDataModelView.getDataModel();
                if (rawRatioDataModel1.containsFitFunction(fitFunctionType)) {
                    rawRatioDataModel1.setSelectedFitFunctionType(fitFunctionType);
                }
                try {
                    rawDataModelView.updatePlotsWithChanges((FitFunctionDataInterface) rawDataModelView);
                } catch (Exception e2) {
                }
            }
            ((TripoliSessionRawDataView) sampleSessionDataView).getTripoliSession().setFitFunctionsUpToDate(false);
            // ((AbstractRawDataView) sampleSessionDataView).refreshPanel(true);

            for (int i = 0; i < rawDataModelViews.length; i++) {
                rawDataModelViews[i].refreshPanel(false, false);
            }
//            // be sure changes to unknowns go to data table
//            if (rawDataModelViews[0] instanceof FitFunctionsOnRatioDataView) {
//                if (((FitFunctionDataInterface) rawDataModelViews[0]).amShowingUnknownFraction()) {
//                    updateReportTable();
//                }
//            }

            updateReportTable();
        });

        fitFunctionButtonGroup.add(functionChoiceButton);
        return functionChoiceButton;
    }
 
Example 11
Source File: ConditionsQueryFrame.java    From StudentSystem with Apache License 2.0 4 votes vote down vote up
/**
* 
* @param owner ���ĸ�����
* @param title ������
* @param modal ָ����ģʽ���ڣ����з�ģʽ����
*/
  public ConditionsQueryFrame(JDialog owner, String title, boolean modal,JTable jt){
  	super(owner, title, modal);
  	this.jd = this;
  	this.setLayout(null);
  	
  	student_ID = new JLabel("ѧ��:");
  	student_ID.setBounds(29, 19, 30, 20);
  	this.add(student_ID);
  	
  	student_IDText = new JTextField();
  	student_IDText.setBounds(65, 19, 100, 20);
  	this.add(student_IDText);
  	
  	student_Name = new JLabel("����:");
  	student_Name.setBounds(200, 19, 30, 20);
  	this.add(student_Name);
  	
  	student_NameText = new JTextField();
  	student_NameText.setBounds(240, 19, 100, 20);
  	this.add(student_NameText);
  	
  	sex_Label = new JLabel("�Ա�:");
  	sex_Label.setBounds(29, 50, 30, 20);
  	this.add(sex_Label);
  	
  	sex_Text = new JTextField();
  	sex_Text.setBounds(65, 50, 100, 20);
  	this.add(sex_Text);
  	
  	grade_Label = new JLabel("�꼶:");
  	grade_Label.setBounds(200, 50, 30, 20);
  	this.add(grade_Label);
  	
  	grade_Text = new JTextField();
  	grade_Text.setBounds(240, 50, 100, 20);
  	this.add(grade_Text);
  	
  	department_Label = new JLabel("Ժϵ:");
  	department_Label.setBounds(29, 83, 30, 20);
  	this.add(department_Label);
  	
  	department_Text = new JTextField();
  	department_Text.setBounds(65, 83, 100, 20);
  	this.add(department_Text);
  	
  	major_Label = new JLabel("רҵ:");
  	major_Label.setBounds(200, 83, 30, 20);
  	this.add(major_Label);
  	
  	major_Text = new JTextField();
  	major_Text.setBounds(240, 83, 100, 20);
  	this.add(major_Text);
  	
  	classe_Label = new JLabel("�༶:");
  	classe_Label.setBounds(29,116, 30, 20);
  	this.add(classe_Label);
  	
  	classe_Text = new JTextField();
  	classe_Text.setBounds(65, 116, 100, 20);
  	this.add(classe_Text);
  	
  	conditions_button = new JButton("��������ѯ");
  	conditions_button.setBounds(230, 130, 100, 30);
  	//ע��"��������ѯ"��ť�¼�����
  	conditions_button.addActionListener(new ActionListener() {
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		String id = student_IDText.getText().trim();
		String name = student_NameText.getText().trim();
		String sex = sex_Text.getText().trim();
		String grade = grade_Text.getText().trim();
		String department = department_Text.getText().trim();
		String major = major_Text.getText().trim();
		String classe = classe_Text.getText().trim();
		if(id.equals("")&&name.equals("")&&sex.equals("")&&grade.equals("")&&department.equals("")&&major.equals("")&&classe.equals("")){
			JOptionPane.showMessageDialog(jd, "��������Ϊ�գ�", "", JOptionPane.WARNING_MESSAGE);
			return ;
		}else{
			String sql = CreateSql.getConditions_Sql(id, name, sex, grade, department, major, classe);
			StudentModel sm = new StudentModel(sql,jd);
			jt.setModel(sm);
			jd.dispose();
		}
		
	}
});
  	this.add(conditions_button);
  	
  	
  	this.setSize(411, 222);
  	this.setResizable(false);
  	WindowUtil.setFrameCenter(this);
  	this.setVisible(true);
  }
 
Example 12
Source File: BroadcastFrame.java    From JRakNet with MIT License 4 votes vote down vote up
/**
 * Creates a broadcast test frame.
 */
protected BroadcastFrame() {
	// Frame and content settings
	this.setResizable(false);
	this.setSize(FRAME_WIDTH, FRAME_HEIGHT);
	this.setTitle("JRakNet Broadcast Test");
	this.getContentPane().setLayout(null);

	// Discovered MCPE Servers
	JTextPane txtpnDiscoveredMcpeServers = new JTextPane();
	txtpnDiscoveredMcpeServers.setEditable(false);
	txtpnDiscoveredMcpeServers.setBackground(UIManager.getColor("Button.background"));
	txtpnDiscoveredMcpeServers.setText("Discovered servers");
	txtpnDiscoveredMcpeServers.setBounds(10, 10, 350, 20);
	this.getContentPane().add(txtpnDiscoveredMcpeServers);

	// How the client will discover servers on the local network
	JComboBox<String> comboBoxDiscoveryType = new JComboBox<String>();
	comboBoxDiscoveryType.setToolTipText(
			"Changing this will update how the client will discover servers, by default it will look for any possible connection on the network");
	comboBoxDiscoveryType.setModel(new DefaultComboBoxModel<String>(DISCOVERY_MODE_OPTIONS));
	comboBoxDiscoveryType.setBounds(370, 10, 115, 20);
	comboBoxDiscoveryType.addActionListener(new RakNetBroadcastDiscoveryTypeListener());
	this.getContentPane().add(comboBoxDiscoveryType);

	// Used to update the discovery port
	JTextField textFieldDiscoveryPort = new JTextField();
	textFieldDiscoveryPort.setBounds(370, 45, 115, 20);
	textFieldDiscoveryPort.setText(Integer.toString(Discovery.getPorts()[0]));
	this.getContentPane().add(textFieldDiscoveryPort);
	textFieldDiscoveryPort.setColumns(10);
	JButton btnUpdatePort = new JButton("Update Port");
	btnUpdatePort.setBounds(370, 76, 114, 23);
	btnUpdatePort.addActionListener(new RakNetBroadcastUpdatePortListener(textFieldDiscoveryPort));
	this.getContentPane().add(btnUpdatePort);

	// The text containing the discovered MCPE servers
	txtPnDiscoveredMcpeServerList = new JTextPane();
	txtPnDiscoveredMcpeServerList.setToolTipText("This is the list of the discovered servers on the local network");
	txtPnDiscoveredMcpeServerList.setEditable(false);
	txtPnDiscoveredMcpeServerList.setBackground(UIManager.getColor("Button.background"));
	txtPnDiscoveredMcpeServerList.setBounds(10, 30, 350, 165);
	this.getContentPane().add(txtPnDiscoveredMcpeServerList);
}
 
Example 13
Source File: ReservedCheckinWindow.java    From Hotel-Properties-Management-System with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the dialog.
 */
public ReservedCheckinWindow(Room roomNumber) {

	this.ownInjectedRoom = roomNumber;
	
	loggingEngine = LoggingEngine.getInstance();
	loggingEngine.setMessage("User is : " + sessionBean.getNickName());
	
	setMinimumSize(new Dimension(750, 495));
	setPreferredSize(new Dimension(750, 495));
	setLocationRelativeTo(null);

	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));

	getContentPane().setForeground(new Color(255, 99, 71));
	getContentPane().setFocusCycleRoot(true);
	getContentPane().setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	getContentPane().setFont(new Font("Verdana", Font.BOLD, 12));
	setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	setModal(true);
	setResizable(false);

	this.setTitle("Coder HPMSA - [Checkin]");
	contentPanel.setAutoscrolls(true);
	contentPanel.setPreferredSize(new Dimension(10, 415));

	contentPanel.setBackground(Color.decode("#066d95"));
	contentPanel.setLayout(new BorderLayout(0, 0));
	getContentPane().add(contentPanel, BorderLayout.SOUTH);

	upperPanel = new JPanel();
	upperPanel.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	upperPanel.setBackground(new Color(135, 206, 235));
	upperPanel.setPreferredSize(new Dimension(10, 35));
	contentPanel.add(upperPanel, BorderLayout.NORTH);

	JLabel lblChangeRoomPerson = new JLabel("Change person count : ");
	lblChangeRoomPerson.setFont(new Font("Arial", Font.PLAIN, 15));
	upperPanel.add(lblChangeRoomPerson);

	spinner = new JSpinner();
	spinner.setModel(new SpinnerNumberModel(1, 1, 3, 1));
	spinner.setPreferredSize(new Dimension(40, 20));
	spinner.setMinimumSize(new Dimension(35, 20));
	spinner.addChangeListener(customerCounterListener());
	upperPanel.add(spinner);

	JPanel buttonPanel = new JPanel();
	buttonPanel.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	buttonPanel.setPreferredSize(new Dimension(10, 50));
	buttonPanel.setLayout(null);
	getContentPane().add(buttonPanel, BorderLayout.NORTH);

	JButton roomCheckinBtn = new JButton("Room checkin");
	roomCheckinBtn.addActionListener(this);
	roomCheckinBtn.setIcon(new ImageIcon(ReservedCheckinWindow.class
					.getResource("/com/coder/hms/icons/extra_checkin.png")));
	roomCheckinBtn.setBounds(7, 4, 130, 42);
	buttonPanel.add(roomCheckinBtn);

	final JSeparator separator = new JSeparator();
	separator.setBackground(Color.DARK_GRAY);
	separator.setBounds(149, 6, 10, 36);
	separator.setOrientation(SwingConstants.VERTICAL);
	separator.setFocusable(true);
	separator.setForeground(Color.DARK_GRAY);
	separator.setAutoscrolls(true);
	separator.setPreferredSize(new Dimension(10, 20));
	buttonPanel.add(separator);

	JLabel lblRoom = new JLabel("ROOM : ");
	lblRoom.setFont(new Font("Verdana", Font.BOLD, 15));
	lblRoom.setBounds(330, 8, 68, 33);
	buttonPanel.add(lblRoom);

	JLabel roomNumberLbl = new JLabel(ownInjectedRoom.getNumber());
	roomNumberLbl.setForeground(new Color(220, 20, 60));
	roomNumberLbl.setFont(new Font("Verdana", Font.BOLD, 17));
	roomNumberLbl.setBounds(406, 8, 103, 33);
	buttonPanel.add(roomNumberLbl);
	
	contentPanel.add(customerFormOne.setCustomerDetailPanel(), BorderLayout.WEST);
	prepareCustomerForms(ownInjectedRoom.getNumber());

}
 
Example 14
Source File: DiscoMixer.java    From aurous-app with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	discoFrame = new JFrame();
	discoFrame.setTitle("Disco Mixer");
	discoFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(
			DiscoMixer.class.getResource("/resources/aurouslogo.png")));
	discoFrame.setType(Type.UTILITY);
	discoFrame.setResizable(false);
	discoFrame.setBounds(100, 100, 606, 239);
	discoFrame
	.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
	discoFrame.getContentPane().setLayout(null);
	discoFrame.addWindowListener(new java.awt.event.WindowAdapter() {
		@Override
		public void windowClosing(
				final java.awt.event.WindowEvent windowEvent) {
			final int confirm = JOptionPane.showOptionDialog(discoFrame,
					"Are You Sure You Want to Close Disco Mixer?",
					"Exit Confirmation", JOptionPane.YES_NO_OPTION,
					JOptionPane.QUESTION_MESSAGE, null, null, null);
			if (confirm == 0) {
				Playlist.getPlaylist().discoOpen = false;
				discoFrame.dispose();
			}

		}
	});

	final JLabel logoLabel = new JLabel("");
	logoLabel.setHorizontalAlignment(SwingConstants.CENTER);
	logoLabel.setIcon(new ImageIcon(DiscoMixer.class
			.getResource("/resources/fmw.png")));
	logoLabel.setBounds(10, 0, 580, 70);
	discoFrame.getContentPane().add(logoLabel);

	discoProgressBar = new JProgressBar();
	discoProgressBar.setStringPainted(true);
	discoProgressBar.setBounds(113, 119, 380, 49);
	discoProgressBar.setVisible(false);
	discoFrame.getContentPane().add(discoProgressBar);

	queryField = new JTextField();
	queryField.setFont(new Font("Segoe UI", Font.PLAIN, 20));
	queryField.setHorizontalAlignment(SwingConstants.CENTER);
	queryField.setBounds(113, 119, 380, 44);
	discoFrame.getContentPane().add(queryField);
	queryField.setColumns(10);

	final JLabel instructionsLabel = new JLabel(
			"Enter an Artist, Song or Choose from the Top 100!");
	instructionsLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
	instructionsLabel.setHorizontalAlignment(SwingConstants.CENTER);
	instructionsLabel.setBounds(23, 81, 541, 27);
	discoFrame.getContentPane().add(instructionsLabel);

	discoBuildButton = new JButton("Disco!");
	discoBuildButton.addActionListener(e -> {
		if (!queryField.getText().trim().isEmpty()) {
			discoProgressBar.setVisible(true);
			YouTubeDiscoUtils.buildDiscoPlayList(queryField.getText());
		} else {
			JOptionPane.showMessageDialog(discoFrame,
					"Please enter search query", "Error",
					JOptionPane.ERROR_MESSAGE);
			return;
		}
	});
	discoBuildButton.setForeground(Color.BLACK);
	discoBuildButton.setBounds(197, 174, 100, 26);
	discoFrame.getContentPane().add(discoBuildButton);

	top100Button = new JButton("Top Hits!");
	top100Button.addActionListener(e -> {
		discoProgressBar.setVisible(true);
		YouTubeDiscoUtils.buildTopPlayList();
	});
	top100Button.setForeground(Color.BLACK);
	top100Button.setBounds(307, 174, 100, 26);
	discoFrame.getContentPane().add(top100Button);
	Playlist.getPlaylist().discoOpen = true;
	final GhostText ghostText = new GhostText("Ghost B.C.", queryField);
	ghostText.setHorizontalAlignment(SwingConstants.CENTER);
	discoFrame.setLocationRelativeTo(UISession.getPresenter().jfxPanel);
}
 
Example 15
Source File: DialogFrame.java    From Hotel-Properties-Management-System with GNU General Public License v2.0 4 votes vote down vote up
public DialogFrame() {
	
	setType(Type.POPUP);
	setResizable(false);
	
	setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
	this.setTitle("Approving question");
	this.setPreferredSize(new Dimension(400, 190));
	this.setAlwaysOnTop(isAlwaysOnTopSupported());
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	getContentPane().setLayout(new BorderLayout());
	
	final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	
	this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75);
	
	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));
	
	final JPanel panel = new JPanel();
	panel.setAutoscrolls(true);
	getContentPane().add(panel, BorderLayout.CENTER);
	panel.setLayout(null);
	
	btnYes = new JButton("YES");
	btnYes.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	btnYes.setBounds(291, 129, 91, 29);
	panel.add(btnYes);
	
	btnNo = new JButton("NO");
	btnNo.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	btnNo.setBounds(199, 129, 91, 29);
	panel.add(btnNo);
	
	lblIcon = new JLabel("");
	lblIcon.setIcon(new ImageIcon(DialogFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png")));
	lblIcon.setBounds(14, 40, 69, 70);
	panel.add(lblIcon);
	
	
	textArea = new JTextArea();
	textArea.setDisabledTextColor(new Color(153, 204, 255));
	textArea.setBounds(95, 32, 287, 85);
	textArea.setBackground(UIManager.getColor("ComboBox.background"));
	textArea.setBorder(null);
	textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	textArea.setEditable(false);
	textArea.setFont(new Font("Monospaced", Font.PLAIN, 14));
	textArea.setLineWrap(true);
	panel.add(textArea);
	
	this.pack();
}
 
Example 16
Source File: TesteComponentes.java    From dctb-utfpr-2018-1 with Apache License 2.0 4 votes vote down vote up
public void TesteComponente(){
    janela.setVisible(true);
    janela.setSize(DIMENSOES);
    janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    JScrollPane teste1 = new JScrollPane(painel);
    teste1.setBounds(1, 2, 150, 200);
    
    JButton teste2 = new JButton("Aperte");
    teste2.setBounds(210, 2, 100, 100);
    
    JToggleButton teste3 = new JToggleButton("Toggle");
    teste3.setBounds(320, 2, 100, 100);
    
    JCheckBox teste4 = new JCheckBox("Teste");
    teste4.setBounds(430, 2, 100, 100);
    
    JRadioButton teste5 = new JRadioButton("Teste2");
    teste5.setBounds(540, 2, 100, 100);
    
    JTextField teste6 = new JTextField();
    teste6.setToolTipText("Seu Nome");
    teste6.setBounds(1, 205, 200, 50);
    
    String[] numeros = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
    JList teste7 = new JList(numeros);
    JScrollPane teste7_2 = new JScrollPane(teste7);
    teste7_2.setBounds(210, 205, 100, 100);
    
    String[] numeros2 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
    JComboBox teste8 = new JComboBox(numeros2);
    teste8.setBounds(320, 205, 50, 50);
    
    JLabel teste9 = new JLabel();
    teste9.setText("Biografia: ");
    teste9.setBounds(1, 290, 200, 100);
    
    JTextArea teste10 = new JTextArea();
    teste10.setToolTipText("Biografia");
    teste10.setBounds(1, 350, 100, 100);
    
    teste2.addActionListener(this);
    teste3.addActionListener(this);
    teste4.addActionListener(this);
    teste5.addActionListener(this);
    
    janela.add(teste1);
    janela.add(teste2);
    janela.add(teste3);
    janela.add(teste4);
    janela.add(teste5);
    janela.add(teste6);
    janela.add(teste7);
    janela.add(teste8);
    janela.add(teste9);
    janela.add(teste10);
}
 
Example 17
Source File: FieldConfigString.java    From sldeditor with GNU General Public License v3.0 4 votes vote down vote up
/** Creates the ui. */
/*
 * (non-Javadoc)
 *
 * @see com.sldeditor.ui.detail.config.FieldConfigBase#createUI()
 */
@Override
public void createUI() {
    if (textField == null) {
        int xPos = getXPos();
        FieldPanel fieldPanel = createFieldPanel(xPos, getLabel());

        textField = new TextFieldPropertyChange();
        textField.setBounds(
                xPos + BasePanel.WIDGET_X_START,
                0,
                this.isValueOnly()
                        ? BasePanel.WIDGET_EXTENDED_WIDTH
                        : BasePanel.WIDGET_STANDARD_WIDTH,
                BasePanel.WIDGET_HEIGHT);
        fieldPanel.add(textField);

        textField.addPropertyChangeListener(
                TextFieldPropertyChange.TEXT_PROPERTY,
                new PropertyChangeListener() {

                    /*
                     * (non-Javadoc)
                     *
                     * @see java.beans.PropertyChangeListener#propertyChange(java.beans. PropertyChangeEvent)
                     */
                    @Override
                    public void propertyChange(PropertyChangeEvent evt) {
                        String originalValue = (String) evt.getOldValue();
                        String newValueObj = (String) evt.getNewValue();

                        valueStored(originalValue, newValueObj);
                    }
                });

        if (maximumStringSize > 0) {
            textField.setDocument(new JTextFieldLimit(maximumStringSize));
        }

        if (buttonText != null) {
            final JButton buttonExternal = new JButton(buttonText);
            buttonExternal.addActionListener(
                    new ActionListener() {

                        public void actionPerformed(ActionEvent e) {
                            externalButtonPressed(buttonExternal);
                        }
                    });

            int buttonWidth = 26;
            int padding = 3;
            buttonExternal.setBounds(
                    xPos + textField.getX() - buttonWidth - padding,
                    0,
                    buttonWidth,
                    BasePanel.WIDGET_HEIGHT);
            fieldPanel.add(buttonExternal);
        }

        if (!isValueOnly()) {
            setAttributeSelectionPanel(
                    fieldPanel.internalCreateAttrButton(String.class, this, isRasterSymbol()));
        }
    }
}
 
Example 18
Source File: NetworkProxyConnectionPanel.java    From Ardulink-1 with Apache License 2.0 4 votes vote down vote up
/**
 * Create the panel.
 */
public NetworkProxyConnectionPanel() {
	Dimension dimension = new Dimension(275, 200);
	setPreferredSize(dimension);
	setMinimumSize(dimension);
	setLayout(null);
	
	connectionPanel = new SerialConnectionPanel();
	connectionPanel.setLocation(0, 115);
	connectionPanel.setSize(connectionPanel.getPreferredSize());
	connectionPanel.setEnabled(false);
	add(connectionPanel);
	
	JLabel lblHostName = new JLabel("Host Name:");
	lblHostName.setHorizontalAlignment(SwingConstants.RIGHT);
	lblHostName.setBounds(6, 12, 91, 16);
	add(lblHostName);
	
	hostNameTextField = new JTextField();
	hostNameTextField.setColumns(10);
	hostNameTextField.setBounds(108, 6, 161, 28);
	add(hostNameTextField);
	
	JLabel lblHostPort = new JLabel("Host Port:");
	lblHostPort.setHorizontalAlignment(SwingConstants.RIGHT);
	lblHostPort.setBounds(6, 45, 91, 16);
	add(lblHostPort);
	
	hostPortTextField = new JTextField();
	hostPortTextField.setColumns(10);
	hostPortTextField.setBounds(108, 39, 161, 28);
	hostPortTextField.setText(String.valueOf(NetworkProxyConnection.DEFAULT_LISTENING_PORT));
	add(hostPortTextField);
	
	activateButton = new JButton("Activate Proxy");
	activateButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			String hostName = hostNameTextField.getText();
			if (nullOrEmpty(hostName)) {
				hostName = "127.0.0.1";
				hostNameTextField.setText(hostName);
			}
			String hostPortString = hostPortTextField.getText();
			int hostPort = -1;
			try {
				hostPort = Integer.parseInt(hostPortString);
			}
			catch(NumberFormatException nfe) {
				JOptionPane.showMessageDialog(hostPortTextField, "Invalid host port. " + hostPortString, "Error", JOptionPane.ERROR_MESSAGE);
			}
			if(hostPort != -1) {
				try {
					// Create a NetworkProxyConnection (the Connection implementation to send data over the net)
					// params are hostname and hostport
					NetworkProxyConnection connection = new NetworkProxyConnection(hostName, hostPort);
					
					// Create a Link class (so now we use this instead of the default one)
					link = Link.createInstance(hostPortTextField.getParent().toString(), connection);
					connectionPanel.setLink(link);
					
					connectionPanel.setEnabled(true);
					activateButton.setEnabled(false);
					hostNameTextField.setEnabled(false);
					hostPortTextField.setEnabled(false);
				}
				catch(Exception ex) {
					JOptionPane.showMessageDialog(hostPortTextField.getParent(), ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
				}
			}
		}
	});
	activateButton.setBounds(5, 75, 264, 28);
	add(activateButton);
}
 
Example 19
Source File: WelcomePane.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
private JPanel createButtonsPane() {
  final int buttonPaneHeight = backgroundImage.getHeight( null );
  final JPanel buttonPane = new JPanel();
  buttonPane.setLayout( null );
  buttonPane.setOpaque( false );
  buttonPane.setBackground( new Color( 0, 0, 0, 0 ) );
  buttonPane.setBorder( new EmptyBorder( 0, 0, 0, 0 ) );
  buttonPane.setMinimumSize( new Dimension( 514, buttonPaneHeight ) );
  buttonPane.setMaximumSize( new Dimension( 514, buttonPaneHeight ) );
  buttonPane.setPreferredSize( new Dimension( 514, buttonPaneHeight ) );

  try {
    final Class wizardClass =
      Class.forName( "org.pentaho.reporting.designer.extensions.wizard.NewWizardReportAction" );
    final AbstractDesignerContextAction newWizardActionListener =
      (AbstractDesignerContextAction) wizardClass.newInstance();
    newWizardActionListener.setReportDesignerContext( reportDesignerContext );
    final JButton wizardBtn = new TransparentButton();
    wizardBtn.addActionListener( newWizardActionListener );
    wizardBtn.addActionListener( closeActionListener );
    wizardBtn.setBorderPainted( true );
    wizardBtn.setBounds( 117, 137, 100, 118 );
    buttonPane.add( wizardBtn );

    final JLabel wizardLabel =
      new JLabel( newWizardActionListener.getValue( "WIZARD.BUTTON.TEXT" ).toString(), JLabel.CENTER ); //NON-NLS
    wizardLabel.setBounds( 80, 273, 165, 56 );
    buttonPane.add( wizardLabel );

    final JButton wizardLabelBtn = new TransparentButton();
    wizardLabelBtn.addActionListener( newWizardActionListener );
    wizardLabelBtn.addActionListener( closeActionListener );
    wizardLabelBtn.setBorderPainted( true );
    wizardLabelBtn.setBounds( 80, 273, 165, 56 );
    buttonPane.add( wizardLabelBtn );
  } catch ( Exception e ) {
    // todo: Remove me. Replace the code with a real extension mechanism
  }

  // Adds the new (blank) report button
  final JButton newReportBtn = new TransparentButton();
  newReportBtn.addActionListener( newReportAction );
  newReportBtn.addActionListener( closeActionListener );
  newReportBtn.setBorderPainted( true );
  newReportBtn.setBounds( 323, 137, 100, 118 );
  buttonPane.add( newReportBtn );

  final JLabel newReportLabel = new JLabel( Messages.getString( "WelcomePane.newReportLabel" ), JLabel.CENTER );
  newReportLabel.setBounds( 285, 273, 165, 56 );
  buttonPane.add( newReportLabel );

  final JButton newReportLabelBtn = new TransparentButton();
  newReportLabelBtn.addActionListener( newReportAction );
  newReportLabelBtn.addActionListener( closeActionListener );
  newReportLabelBtn.setBorderPainted( true );
  newReportLabelBtn.setBounds( 285, 273, 165, 56 );
  buttonPane.add( newReportLabelBtn );
  return buttonPane;
}
 
Example 20
Source File: MaliciousCodeScannerOptions.java    From bytecode-viewer with GNU General Public License v3.0 4 votes vote down vote up
public MaliciousCodeScannerOptions() {
    this.setIconImages(Resources.iconList);
    setSize(new Dimension(250, 323));
    setResizable(false);
    setTitle("Malicious Code Scanner Options");
    getContentPane().setLayout(null);

    final JCheckBox chckbxJavalangreflection = new JCheckBox(
            "java/lang/reflection");
    chckbxJavalangreflection.setSelected(true);
    chckbxJavalangreflection.setBounds(6, 7, 232, 23);
    getContentPane().add(chckbxJavalangreflection);

    final JCheckBox chckbxJavanet = new JCheckBox("java/net");
    chckbxJavanet.setSelected(true);
    chckbxJavanet.setBounds(6, 81, 232, 23);
    getContentPane().add(chckbxJavanet);

    final JCheckBox chckbxJavaio = new JCheckBox("java/io");
    chckbxJavaio.setBounds(6, 104, 232, 23);
    getContentPane().add(chckbxJavaio);

    final JCheckBox chckbxJavalangruntime = new JCheckBox(
            "java/lang/Runtime");
    chckbxJavalangruntime.setSelected(true);
    chckbxJavalangruntime.setBounds(6, 33, 232, 23);
    getContentPane().add(chckbxJavalangruntime);

    final JCheckBox chckbxLdcContainswww = new JCheckBox(
            "LDC contains 'www.'");
    chckbxLdcContainswww.setSelected(true);
    chckbxLdcContainswww.setBounds(6, 130, 232, 23);
    getContentPane().add(chckbxLdcContainswww);

    final JCheckBox chckbxLdcContainshttp = new JCheckBox(
            "LDC contains 'http://'");
    chckbxLdcContainshttp.setSelected(true);
    chckbxLdcContainshttp.setBounds(6, 156, 232, 23);
    getContentPane().add(chckbxLdcContainshttp);

    final JCheckBox chckbxLdcContainshttps = new JCheckBox(
            "LDC contains 'https://'");
    chckbxLdcContainshttps.setSelected(true);
    chckbxLdcContainshttps.setBounds(6, 182, 232, 23);
    getContentPane().add(chckbxLdcContainshttps);

    final JCheckBox chckbxLdcMatchesIp = new JCheckBox(
            "LDC matches IP regex");
    chckbxLdcMatchesIp.setSelected(true);
    chckbxLdcMatchesIp.setBounds(6, 208, 232, 23);
    getContentPane().add(chckbxLdcMatchesIp);

    final JCheckBox chckbxNullSecMan = new JCheckBox(
            "SecurityManager set to null");
    chckbxNullSecMan.setSelected(true);
    chckbxNullSecMan.setBounds(6, 234, 232, 23);
    getContentPane().add(chckbxNullSecMan);

    final JCheckBox chckbxJavaawtrobot = new JCheckBox("java/awt/Robot");
    chckbxJavaawtrobot.setSelected(true);
    chckbxJavaawtrobot.setBounds(6, 59, 232, 23);
    getContentPane().add(chckbxJavaawtrobot);

    JButton btnNewButton = new JButton("Start Scanning");
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            PluginManager.runPlugin(new MaliciousCodeScanner(
                    chckbxJavalangreflection.isSelected(),
                    chckbxJavalangruntime.isSelected(),
                    chckbxJavanet.isSelected(),
                    chckbxJavaio.isSelected(),
                    chckbxLdcContainswww.isSelected(),
                    chckbxLdcContainshttp.isSelected(),
                    chckbxLdcContainshttps.isSelected(),
                    chckbxLdcMatchesIp.isSelected(),
                    chckbxNullSecMan.isSelected(),
                    chckbxJavaawtrobot.isSelected()));
            dispose();
        }
    });

    btnNewButton.setBounds(6, 264, 232, 23);
    getContentPane().add(btnNewButton);
    this.setLocationRelativeTo(null);
}