JButton_SaveOptions.addActionListener( new. setIcon ( new (getClass().getResource( "/marytts/tools/redstart/ok_16x16.png" ))) JLabel_AudioMixer = new () ĬbAudioSource = new () setIcon ( new (getClass().getResource( "/marytts/tools/redstart/playing_16x16.png" ))) setIcon ( new (getClass().getResource( "/marytts/tools/redstart/recording_16x16.png" ))) Gbc.gridx = 0 optionsPanel.add(optionLog, gbc) Icon = ImageIO.read(getClass().getClassLoader().getResource( "gear.png" )) Icon = ImageIO.read(getClass().getClassLoader().getResource( "list.png" )) Icon = ImageIO.read(getClass().getClassLoader().getResource( "time.png" )) Icon = ImageIO.read(getClass().getClassLoader().getResource( "comment.png" )) JPanel statusPanel = new JPanel( new GridBagLayout()) JPanel ripPanel = new JPanel( new GridBagLayout()) Full code of creating button and set icon: tactButton new JButton ('next tact') tSize (100, 100) tIcon (new ImageIcon ( ('/images/buttonnext.jpg'))) tactButton.addActionListener (new ProcessorNextStepListener (this)) java. Image stopIcon = ImageIO.read(getClass().getClassLoader().getResource( "stop.png" )) RipButton = new JButton ( "Rip", ripIcon) ImageIcon ripIcon = new ImageIcon(mainIcon) SetFileChooserStyle(((Container)comp).RipTextfield.addMouseListener( new ContextMenuMouseListener()) Public void setFileChooserStyle(Component comp) Prop.store(new FileOutputStream(JARFile), null) ĭesktop.getDesktop().open(new File(getConfig("path." number))) Ĭlass MyMouseListener extends MouseAdapter Public void WriteConfig(File file, int number) String configstr = prop.getProperty(name) Return new File(jarFile.getParentFile().getPath()) PrintWriter writer = new PrintWriter(JARFile, "UTF-8") įile jarFile = new File(().getCodeSource().getLocation().toURI().getPath()) tIconImage((new ImageIcon(getClass().getResource("/SRC/APPICON.PNG"))).getImage()) WriteConfig(chooser.getSelectedFile(), Integer.parseInt(tmp)) ītIcon(FileSystemView.getFileSystemView().getSystemIcon(chooser.getSelectedFile())) Int confirm = chooser.showSaveDialog(null) String tmp = (String)JOptionPane.showInputDialog(null, "Whick shortcut are you going to change?", "Change shortcut", JOptionPane.INFORMATION_MESSAGE, null, options, options) Uim.put("OptionPane.cancelButtonText", "Cancel") ĬtDialogTitle("Choose save location:") ĬtDialogType(JFileChooser.SAVE_DIALOG) īutton_C.addMouseListener(new MouseAdapter() Uim.put("OptionPane.okButtonText", "OK") Uim.put("Button.background", Color.WHITE) SetFileChooserStyle(chooser.getComponents()) GetContentPane().setBackground(new Color(82,29,2)) tDefaultLocale(Locale.ENGLISH) īutton_C.setPreferredSize(new Dimension(30, 80)) Int cor_y = (int)Math.round(MouseInfo.getPointerInfo().getLocation().getY()) īutton.addMouseListener(new MyMouseListener(i 1)) Int cor_x = (int)Math.round(MouseInfo.getPointerInfo().getLocation().getX()) W.addMouseMotionListener(new MouseAdapter() W.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) Ĭor_initial_x = (int)Math.round(MouseInfo.getPointerInfo().getLocation().getX()) Ĭor_initial_y = (int)Math.round(MouseInfo.getPointerInfo().getLocation().getY()) tPreferredSize(new Dimension(80,80)) įinal JLaunch w = new JLaunch("JLaunch 1.0") Static int cor_initial_x, cor_initial_y, x1, x2 How can the icon fill the entire button (for example, having a custom size of 48x48, or automatically filled the button)? The frame will not be resized.įont f1 = new Font("Microsoft Jhenghei", Font.PLAIN, 12) įont f2 = new Font("Microsoft Jhenghei", Font.PLAIN, 48) īorder b1 = new LineBorder(Color.WHITE, 1) įile JARFile = new File(getJARPath() "\\PREF.PROPERTIES\\") įileNameExtensionFilter filter = new FileNameExtensionFilter("Executable files", "exe") However, the icons are very small and they don't fill the entire button. Here the getConfig() method is already defined to get a string in a "properties" file. Still there are some problems.ītIcon(FileSystemView.getFileSystemView().getSystemIcon(new File(getConfig("path." (i 1))))) I tried to get the executable icons and set them on the JButtons. Recently I have been working on an executable launcher.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |