

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.
#SET ICON OF JBUTTON UPDATE#
I have a feeling you are not setting the properties on the button you think you are, since calling tIcon() in an action does generally update the icon without needing any other calls i.e.Recently I have been working on an executable launcher. The icon or image can be loaded from a local file in the disc or somewhere from the internet or even from the raw bytes. This class often useful for displaying an image icon in a swing component like JLabel, JButton, etc. Any ideas on what's going on when you make calls to a component, and that component doesn't display the latest call? The ImageIcon class represents an icon or an image. I've even made these calls later, sequentially in the code, and the GUIs not getting updated. I've tried setting the text, icon, background color - nothing seems to work. What I can tell you though is that all I want to do is set the icon inside of the action command, and it's not working. It's about 800 lines long, and I'm not really allowed to by my work. Unfortunately, I can't really paste my code. Sorry, didn't mean to hijack - I just figured since we were both having the same exact problem, I'd let you know I was interested in anything you found out.

String codeSeg = code.substring(0,guesses) Public void actionPerformed(ActionEvent e) Public class IanSays extends JFrame implements ActionListener Unfortunately, the icons do not change after that point. I am trying to create a simon-says type game, where there are four icons of different colors.
