mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 21:50:46 +00:00
Code formatting
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.jpexs.asdec.gui;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -28,56 +27,57 @@ import javax.swing.UnsupportedLookAndFeelException;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class View {
|
||||
/**
|
||||
* Sets windows Look and Feel
|
||||
*/
|
||||
public static void setWinLookAndFeel() {
|
||||
try {
|
||||
|
||||
UIManager.setLookAndFeel(
|
||||
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (UnsupportedLookAndFeelException ignored) {
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
} catch (InstantiationException ignored) {
|
||||
} catch (IllegalAccessException ignored) {
|
||||
}
|
||||
/**
|
||||
* Sets windows Look and Feel
|
||||
*/
|
||||
public static void setWinLookAndFeel() {
|
||||
try {
|
||||
|
||||
}
|
||||
UIManager.setLookAndFeel(
|
||||
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
||||
} catch (UnsupportedLookAndFeelException ignored) {
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
} catch (InstantiationException ignored) {
|
||||
} catch (IllegalAccessException ignored) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads image from resources
|
||||
*
|
||||
* @param path Path to image without starting slash
|
||||
* @return loaded Image
|
||||
*/
|
||||
public static Image loadImage(String path) {
|
||||
ClassLoader cldr = (new Object()).getClass().getClassLoader();
|
||||
java.net.URL imageURL = (new Object()).getClass().getResource("/" + path);
|
||||
return Toolkit.getDefaultToolkit().createImage(imageURL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets icon of specified frame to ASDec icon
|
||||
*
|
||||
* @param f Frame to set icon in
|
||||
*/
|
||||
public static void setWindowIcon(Window f) {
|
||||
java.util.List<Image> images = new ArrayList<Image>();
|
||||
images.add(loadImage("com/jpexs/asdec/gui/graphics/icon16.png"));
|
||||
images.add(loadImage("com/jpexs/asdec/gui/graphics/icon32.png"));
|
||||
images.add(loadImage("com/jpexs/asdec/gui/graphics/icon48.png"));
|
||||
f.setIconImages(images);
|
||||
}
|
||||
/**
|
||||
* Loads image from resources
|
||||
*
|
||||
* @param path Path to image without starting slash
|
||||
* @return loaded Image
|
||||
*/
|
||||
public static Image loadImage(String path) {
|
||||
ClassLoader cldr = (new Object()).getClass().getClassLoader();
|
||||
java.net.URL imageURL = (new Object()).getClass().getResource("/" + path);
|
||||
return Toolkit.getDefaultToolkit().createImage(imageURL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Centers specified frame on the screen
|
||||
*
|
||||
* @param f Frame to center on the screen
|
||||
*/
|
||||
public static void centerScreen(Window f) {
|
||||
Dimension dim = f.getToolkit().getScreenSize();
|
||||
Rectangle abounds = f.getBounds();
|
||||
f.setLocation((dim.width - abounds.width) / 2,
|
||||
(dim.height - abounds.height) / 2);
|
||||
}
|
||||
/**
|
||||
* Sets icon of specified frame to ASDec icon
|
||||
*
|
||||
* @param f Frame to set icon in
|
||||
*/
|
||||
public static void setWindowIcon(Window f) {
|
||||
java.util.List<Image> images = new ArrayList<Image>();
|
||||
images.add(loadImage("com/jpexs/asdec/gui/graphics/icon16.png"));
|
||||
images.add(loadImage("com/jpexs/asdec/gui/graphics/icon32.png"));
|
||||
images.add(loadImage("com/jpexs/asdec/gui/graphics/icon48.png"));
|
||||
f.setIconImages(images);
|
||||
}
|
||||
|
||||
/**
|
||||
* Centers specified frame on the screen
|
||||
*
|
||||
* @param f Frame to center on the screen
|
||||
*/
|
||||
public static void centerScreen(Window f) {
|
||||
Dimension dim = f.getToolkit().getScreenSize();
|
||||
Rectangle abounds = f.getBounds();
|
||||
f.setLocation((dim.width - abounds.width) / 2,
|
||||
(dim.height - abounds.height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user