This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JLabel label = new JLabel(""); | |
Image img = new ImageIcon(this.getClass().getResource("/filename.jpg")).getImage(); | |
label.setIcon(new ImageIcon(img)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frame.setExtendedState(JFrame.MAXIMIZED_BOTH); | |
frame.setUndecorated(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Appearance time delay | |
ToolTipManager.sharedInstance().setInitialDelay(0); | |
// Position of appearance | |
JButton button = new JButton("") { | |
@Override | |
public Point getToolTipLocation(MouseEvent event) { | |
return new Point(panel.getWidth() / 2, panel.getHeight() / 2); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frame.setContentPane(new JLabel(new ImageIcon(TestBack.class.getResource("/images/Test.jpg")))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static final int WIDTH = 1280; | |
public static final int HEIGHT = 720; | |
private void initialize() { | |
frame = new JFrame(); | |
frame.setTitle("title"); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.getContentPane().setLayout(null); | |
frame.setPreferredSize(new Dimension(WIDTH, HEIGHT)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package animation; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.RenderingHints; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
@SuppressWarnings("serial") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
container.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); | |
//See Cursors Cheatsheet for the design |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIManager.put("ProgressBar.selectionBackground", Color.red); | |
UIManager.put("ProgressBar.selectionForeground", Color.red); | |
UIManager.put("ProgressBar.foreground", Color.red); | |
UIManager.put("ProgressBar.background", Color.red); | |
JProgressBar bar = new JProgressBar(); | |
bar.setMaximum(50); | |
bar.setMinimum(0); | |
bar.setBounds(30, 118, 235, 41); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Possible solution for HP Bar (Percentage caculation and rectangles) | |
https://gamedev.stackexchange.com/questions/110311/how-to-set-up-health-bar-rect-that-depends-on-health | |
// | |
// | |
// |
OlderNewer