Mass refactoring and refresh. Now we know how to set tab-colors. Also some more keys retrieved - maybe they will be useful in future. Added skeleton for editor panel, also added cool-looking button for it :) NFY - let me sleep a little.
parent
735ceb028d
commit
27a24235d5
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
@ -1,8 +1,8 @@
|
||||
build.xml.data.CRC32=59e91121
|
||||
build.xml.data.CRC32=22fb9f16
|
||||
build.xml.script.CRC32=1097797e
|
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.67.1
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=59e91121
|
||||
nbproject/build-impl.xml.data.CRC32=22fb9f16
|
||||
nbproject/build-impl.xml.script.CRC32=e0c60086
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1
|
||||
|
||||
@ -0,0 +1,259 @@
|
||||
/* Copyright (C) Edward M. Kagan - All Rights Reserved
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
* Proprietary and confidential
|
||||
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015
|
||||
*/
|
||||
package org.idp.laf;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.plaf.metal.DefaultMetalTheme;
|
||||
import javax.swing.plaf.metal.MetalLookAndFeel;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.windows.WindowManager;
|
||||
|
||||
/**
|
||||
* @author Edward M. Kagan <pagan@idp-crew.com>
|
||||
*/
|
||||
public class Kernel {
|
||||
|
||||
public static void load_kernel ()
|
||||
{
|
||||
if (prepare_metal_laf ())
|
||||
{
|
||||
String nb_etc = retrieve_netbeans_etc_dir();
|
||||
setup_font_antialiaing_hints(nb_etc);
|
||||
load_setup (nb_etc);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("Unable to set Metall Look And Feel - no "
|
||||
+ "modifications done. Follow your ugly way of live.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean prepare_metal_laf ()
|
||||
{
|
||||
try {
|
||||
UIManager.getDefaults().clear();
|
||||
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
|
||||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||
return true;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
return false;
|
||||
} catch (InstantiationException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
return false;
|
||||
} catch (IllegalAccessException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
return false;
|
||||
} catch (UnsupportedLookAndFeelException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static String retrieve_netbeans_etc_dir ()
|
||||
{
|
||||
String nb_home = System.getProperty("netbeans.home");
|
||||
String nb_conf = nb_home.substring(0, nb_home.length() - "platform".length()) + "etc" + File.separator;
|
||||
return nb_conf;
|
||||
}
|
||||
|
||||
|
||||
private static boolean setup_font_antialiaing_hints (String nb_etc)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.setProperty("awt.useSystemAAFontSettings","lcd");
|
||||
System.setProperty("swing.aatext", "true");
|
||||
System.setProperty("nb.useSwingHtmlRendering", "true");
|
||||
|
||||
Path path = FileSystems.getDefault().getPath(nb_etc, "netbeans.conf");
|
||||
List<String> linesL = Files.readAllLines(path);
|
||||
String [] lines = new String[linesL.size()];
|
||||
|
||||
int i = 0;
|
||||
for (String str : linesL)
|
||||
{
|
||||
lines[i] = str;
|
||||
i++;
|
||||
}
|
||||
|
||||
for (i =0; i < lines.length; i ++)
|
||||
{
|
||||
if (lines[i].contains("netbeans_default_options="))
|
||||
{
|
||||
if (!lines[i].contains("-J-Dawt.useSystemAAFontSettings"))
|
||||
{
|
||||
System.err.println("No rendering hints defined - fixing...");
|
||||
String [] parts = lines[i].split("\"");
|
||||
String new_line = parts[0] + "\"" + parts[1] + " -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd" + "\"";
|
||||
lines[i] = new_line;
|
||||
write_scheme(nb_etc + "netbeans.conf", lines);
|
||||
System.out.println("Reload Netbeans to update hints!");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Exceptions.printStackTrace(ex);
|
||||
System.err.println("Unable to apply rendering hints :( Sorry...");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean load_setup (String nb_etc)
|
||||
{
|
||||
File scheme_file = new File(nb_etc + File.separator + ".idp_scheme");
|
||||
String path = scheme_file.getAbsolutePath();
|
||||
|
||||
if (!scheme_file.exists())
|
||||
{
|
||||
|
||||
if (save_scheme(path))
|
||||
{
|
||||
return read_scheme (path);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return read_scheme (path);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static boolean save_scheme(String scheme_file) {
|
||||
|
||||
ArrayList<Color> color_map = new ArrayList<Color>();
|
||||
for (int i = 0; i < Keys.color_keys.length; i ++)
|
||||
{
|
||||
|
||||
Object o = UIManager.get(Keys.color_keys[i]);
|
||||
if (o != null)
|
||||
{
|
||||
if (o.getClass().equals(javax.swing.plaf.ColorUIResource.class))
|
||||
{
|
||||
ColorUIResource oo = (ColorUIResource) o;
|
||||
Color c = new Color(Keys.color_keys[i], Color.ColorClass.SF, oo.getRed(), oo.getGreen(), oo.getBlue(), oo.getAlpha());
|
||||
color_map.add(c);
|
||||
//System.out.println( "\"" + Keys.color_keys[i] + "\",");
|
||||
}
|
||||
else if (o.getClass().equals(java.awt.Color.class))
|
||||
{
|
||||
java.awt.Color oo = (java.awt.Color) o;
|
||||
Color c = new Color(Keys.color_keys[i], Color.ColorClass.AT, oo.getRed(), oo.getGreen(), oo.getBlue(), oo.getAlpha());
|
||||
color_map.add(c);
|
||||
//System.out.println( "\"" + Keys.color_keys[i] + "\",");
|
||||
}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// System.out.println( " \"" + Keys.color_keys[i] + "\",");
|
||||
// }
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
PrintWriter writer = new PrintWriter(scheme_file , "UTF-8");
|
||||
for (int i = 0; i < color_map.size(); i ++)
|
||||
{
|
||||
writer.println(color_map.get(i));
|
||||
}
|
||||
writer.close();
|
||||
return true;
|
||||
}
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
Exceptions.printStackTrace(ex);
|
||||
return false;
|
||||
}
|
||||
catch (UnsupportedEncodingException ex)
|
||||
{
|
||||
Exceptions.printStackTrace(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean read_scheme(String scheme_file) {
|
||||
|
||||
try
|
||||
{
|
||||
ArrayList<Color> color_map = new ArrayList<Color>();
|
||||
List<String> C = Files.readAllLines(Paths.get(scheme_file), Charset.forName("UTF-8"));
|
||||
|
||||
for (String s : C)
|
||||
{
|
||||
color_map.add(new Color (s));
|
||||
}
|
||||
|
||||
for (int i = 0; i < color_map.size(); i ++)
|
||||
{
|
||||
UIManager.put(color_map.get(i).getName(), color_map.get(i).getObject());
|
||||
}
|
||||
|
||||
repaintUI();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Exceptions.printStackTrace(ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void repaintUI()
|
||||
{
|
||||
SwingUtilities.updateComponentTreeUI(WindowManager.getDefault().getMainWindow());
|
||||
WindowManager.getDefault().getMainWindow().pack();
|
||||
WindowManager.getDefault().getMainWindow().repaint();
|
||||
}
|
||||
|
||||
private static void write_scheme(String path, String [] data) throws IOException
|
||||
{
|
||||
|
||||
File fout = new File(path);
|
||||
FileOutputStream fos = new FileOutputStream(fout);
|
||||
|
||||
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
|
||||
|
||||
for (int i = 0; i < data.length; i ++)
|
||||
{
|
||||
bw.write(data[i]);
|
||||
bw.newLine();
|
||||
}
|
||||
|
||||
bw.close();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,575 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf;
|
||||
|
||||
|
||||
import java.awt.Insets;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.plaf.metal.DefaultMetalTheme;
|
||||
import javax.swing.plaf.metal.MetalLookAndFeel;
|
||||
import org.idp.laf.settings.Color;
|
||||
import static org.idp.laf.settings.Color.ColorClass.AT;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SS;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SF;
|
||||
import org.idp.laf.settings.Font;
|
||||
import static org.idp.laf.settings.Font.FontClass.FA;
|
||||
import static org.idp.laf.settings.Font.FontClass.FS;
|
||||
import org.idp.laf.settings.Gradient;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.windows.WindowManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class LAF_killer {
|
||||
|
||||
private static void printColor (ColorUIResource cc)
|
||||
{
|
||||
System.out.println(cc.getRed() + " : " + cc.getGreen() + " : " + cc.getBlue());
|
||||
}
|
||||
|
||||
|
||||
public static void load_ui(){
|
||||
|
||||
try {
|
||||
// if (UIManager.getLookAndFeel().getName().equals("Metal"))
|
||||
// {
|
||||
// System.out.println(">>> Hmmm... You smart enought to use Metal theme - OK.");
|
||||
// MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
|
||||
// System.out.println(">>>> l&f NAME = " + UIManager.getLookAndFeel().getName() + " / " + javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme().getName());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
System.out.println(">>>> TRYING TO CHANGE L&F");
|
||||
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
|
||||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||
System.out.println(">>>> l&f NAME = " + UIManager.getLookAndFeel().getName() + " / " + javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme().getName());
|
||||
|
||||
|
||||
|
||||
|
||||
printColor(MetalLookAndFeel.getAcceleratorForeground());
|
||||
printColor(MetalLookAndFeel.getAcceleratorSelectedForeground());
|
||||
printColor(MetalLookAndFeel.getBlack());
|
||||
printColor(MetalLookAndFeel.getControl());
|
||||
printColor(MetalLookAndFeel.getControlDarkShadow());
|
||||
printColor(MetalLookAndFeel.getControlDisabled());
|
||||
printColor(MetalLookAndFeel.getControlHighlight());
|
||||
printColor(MetalLookAndFeel.getControlInfo());
|
||||
printColor(MetalLookAndFeel.getControlShadow());
|
||||
printColor(MetalLookAndFeel.getControlTextColor());
|
||||
printColor(MetalLookAndFeel.getDesktopColor());
|
||||
printColor(MetalLookAndFeel.getFocusColor());
|
||||
printColor(MetalLookAndFeel.getHighlightedTextColor());
|
||||
printColor(MetalLookAndFeel.getInactiveControlTextColor());
|
||||
printColor(MetalLookAndFeel.getInactiveControlTextColor());
|
||||
printColor(MetalLookAndFeel.getInactiveSystemTextColor());
|
||||
printColor(MetalLookAndFeel.getMenuBackground());
|
||||
printColor(MetalLookAndFeel.getMenuDisabledForeground());
|
||||
printColor(MetalLookAndFeel.getMenuForeground());
|
||||
printColor(MetalLookAndFeel.getMenuSelectedBackground());
|
||||
printColor(MetalLookAndFeel.getMenuSelectedForeground());
|
||||
printColor(MetalLookAndFeel.getPrimaryControl());
|
||||
printColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
|
||||
printColor(MetalLookAndFeel.getPrimaryControlHighlight());
|
||||
printColor(MetalLookAndFeel.getPrimaryControlInfo());
|
||||
printColor(MetalLookAndFeel.getSeparatorBackground());
|
||||
printColor(MetalLookAndFeel.getSeparatorForeground());
|
||||
printColor(MetalLookAndFeel.getSystemTextColor());
|
||||
printColor(MetalLookAndFeel.getTextHighlightColor());
|
||||
printColor(MetalLookAndFeel.getUserTextColor());
|
||||
printColor(MetalLookAndFeel.getWhite());
|
||||
printColor(MetalLookAndFeel.getWindowBackground());
|
||||
printColor(MetalLookAndFeel.getWindowTitleBackground());
|
||||
printColor(MetalLookAndFeel.getWindowTitleForeground());
|
||||
printColor(MetalLookAndFeel.getWindowTitleInactiveBackground());
|
||||
printColor(MetalLookAndFeel.getWindowTitleInactiveForeground());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//}
|
||||
|
||||
Object [] keys = new Object[UIManager.getLookAndFeelDefaults().keySet().size()];
|
||||
|
||||
String settings = "";
|
||||
|
||||
UIManager.getLookAndFeelDefaults().keySet().toArray(keys);
|
||||
|
||||
//dump (keys);
|
||||
load ();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (UnsupportedLookAndFeelException ex) {
|
||||
Logger.getLogger(LAF_killer.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void dump(Object [] keys)
|
||||
{
|
||||
|
||||
ArrayList<Color> color_map = new ArrayList<Color>();
|
||||
ArrayList<Font> font_map = new ArrayList<Font>();
|
||||
ArrayList<Gradient> gradient_map = new ArrayList<Gradient>();
|
||||
|
||||
for (int i = 0; i < keys.length; i ++)
|
||||
{
|
||||
|
||||
if (UIManager.getDefaults().get(keys[i]) != null){
|
||||
//This check is needed to overcome null_pointer on first run for this shitty icons
|
||||
// 269 >> Menu.checkIcon : null
|
||||
// 272 >> MenuItem.checkIcon : null
|
||||
|
||||
|
||||
// <editor-fold desc="Extracting colors">
|
||||
if (UIManager.getDefaults().get(keys[i]).getClass().equals(javax.swing.plaf.ColorUIResource.class))
|
||||
{
|
||||
javax.swing.plaf.ColorUIResource color = (javax.swing.plaf.ColorUIResource) UIManager.getDefaults().get(keys[i]);
|
||||
Color c = new Color (keys[i].toString(), SF, color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha());
|
||||
color_map.add(c);
|
||||
}
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(sun.swing.PrintColorUIResource.class))
|
||||
{
|
||||
sun.swing.PrintColorUIResource color = (sun.swing.PrintColorUIResource) UIManager.getDefaults().get(keys[i]);
|
||||
Color c = new Color (keys[i].toString(), SS, color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha());
|
||||
color_map.add(c);
|
||||
}
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(java.awt.Color.class))
|
||||
{
|
||||
java.awt.Color color = (java.awt.Color) UIManager.getDefaults().get(keys[i]);
|
||||
Color c = new Color (keys[i].toString(), AT, color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha());
|
||||
color_map.add(c);
|
||||
}
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold desc="Extracting fonts">
|
||||
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(javax.swing.plaf.FontUIResource.class))
|
||||
{
|
||||
javax.swing.plaf.FontUIResource fnt = (javax.swing.plaf.FontUIResource) UIManager.getDefaults().get(keys[i]);
|
||||
Font f = new Font (keys[i].toString(), FS, fnt.getFamily(), fnt.getName(), fnt.getStyle(), fnt.getSize());
|
||||
font_map.add(f);
|
||||
|
||||
// System.out.println(i + " FX>> " + keys[i] + " : " + UIManager.getDefaults().get(keys[i]));
|
||||
}
|
||||
else if (UIManager.getDefaults().get(keys[i]).getClass().equals(java.awt.Font.class))
|
||||
{
|
||||
java.awt.Font fnt = (java.awt.Font) UIManager.getDefaults().get(keys[i]);
|
||||
Font f = new Font (keys[i].toString(), FA, fnt.getFamily(), fnt.getName(), fnt.getStyle(), fnt.getSize());
|
||||
font_map.add(f);
|
||||
//System.out.println(i + " FY>> " + keys[i] + " : " + UIManager.getDefaults().get(keys[i]));
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
// <editor-fold desc="Extracting gradients">
|
||||
//
|
||||
else if (keys[i].equals("MenuBar.gradient") ||
|
||||
keys[i].equals("ScrollBar.gradient") ||
|
||||
keys[i].equals("ToggleButton.gradient") ||
|
||||
keys[i].equals("CheckBoxMenuItem.gradient") ||
|
||||
keys[i].equals("Slider.gradient") ||
|
||||
keys[i].equals("Button.gradient") ||
|
||||
keys[i].equals("CheckBox.gradient") ||
|
||||
keys[i].equals("RadioButtonMenuItem.gradient") ||
|
||||
keys[i].equals("Slider.focusGradient") ||
|
||||
keys[i].equals("RadioButton.gradient") ||
|
||||
keys[i].equals("InternalFrame.activeTitleGradient")
|
||||
)
|
||||
{
|
||||
//ArrayList always
|
||||
//System.out.println(i + " GY>> " + UIManager.getDefaults().get(keys[i]));
|
||||
List grad = (List) UIManager.getDefaults().get(keys[i]);
|
||||
// for (int j = 0; j < grad.size(); j ++)
|
||||
// {
|
||||
// System.out.println(i + " >> " + grad.get(j).getClass());
|
||||
// }
|
||||
|
||||
Gradient g = new Gradient(keys[i].toString(), ((Float)grad.get(0)), ((Float)grad.get(1)),
|
||||
new Color ((javax.swing.plaf.ColorUIResource) grad.get(2)),
|
||||
new Color ((javax.swing.plaf.ColorUIResource) grad.get(3)),
|
||||
new Color ((javax.swing.plaf.ColorUIResource) grad.get(4)));
|
||||
gradient_map.add(g);
|
||||
}
|
||||
|
||||
// </editor-fold>
|
||||
|
||||
}
|
||||
else // Shitty test for unknown values - dont bother at all
|
||||
{
|
||||
System.out.println(i + " >> " + keys[i] + " : " + UIManager.getDefaults().get(keys[i]));
|
||||
}
|
||||
|
||||
}
|
||||
// Looks scientific? Yeah, it's a formal test :)
|
||||
//
|
||||
// System.out.println("=============== <COLOR MAP> ===============");
|
||||
// for (int i = 0; i < color_map.size(); i ++)
|
||||
// {
|
||||
// System.out.println(i + " : " + color_map.get(i));
|
||||
// }
|
||||
// System.out.println("=============== <FONT MAP> ===============");
|
||||
// for (int i = 0; i < font_map.size(); i ++)
|
||||
// {
|
||||
// System.out.println(i + " : " + font_map.get(i));
|
||||
// }
|
||||
// System.out.println("=============== <GRADIENT MAP> ===============");
|
||||
// for (int i = 0; i < gradient_map.size(); i ++)
|
||||
// {
|
||||
// System.out.println(i + " : " + gradient_map.get(i));
|
||||
// }
|
||||
|
||||
if (!new File (System.getProperty("user.home") + File.separator + ".idp_scheme").exists())
|
||||
{
|
||||
new File (System.getProperty("user.home") + File.separator + ".idp_scheme").mkdir();
|
||||
}
|
||||
|
||||
// File fileC = new File ();
|
||||
// File fileF = new File (System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_fonts");
|
||||
// File fileG = new File (System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_gradients");
|
||||
|
||||
|
||||
try {
|
||||
PrintWriter writer = new PrintWriter(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_colors", "UTF-8");
|
||||
for (int i = 0; i < color_map.size(); i ++)
|
||||
{
|
||||
writer.println(color_map.get(i));
|
||||
}
|
||||
writer.close();
|
||||
|
||||
writer = new PrintWriter(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_fonts", "UTF-8");
|
||||
for (int i = 0; i < font_map.size(); i ++)
|
||||
{
|
||||
writer.println(font_map.get(i));
|
||||
}
|
||||
writer.close();
|
||||
|
||||
writer = new PrintWriter(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_gradients", "UTF-8");
|
||||
for (int i = 0; i < gradient_map.size(); i ++)
|
||||
{
|
||||
System.out.println(gradient_map.get(i));
|
||||
writer.println(gradient_map.get(i));
|
||||
}
|
||||
writer.close();
|
||||
|
||||
} catch (FileNotFoundException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void load()
|
||||
{
|
||||
|
||||
ArrayList<Color> color_map = new ArrayList<Color>();
|
||||
ArrayList<Font> font_map = new ArrayList<Font>();
|
||||
ArrayList<Gradient> gradient_map = new ArrayList<Gradient>();
|
||||
|
||||
|
||||
|
||||
try {
|
||||
if (!new File (System.getProperty("user.home") + File.separator + ".idp_scheme").exists())
|
||||
{
|
||||
System.err.println("FUCK OFF!");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> C = Files.readAllLines(Paths.get(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_colors"), Charset.forName("UTF-8"));
|
||||
for (String s : C)
|
||||
{
|
||||
color_map.add(new Color (s));
|
||||
}
|
||||
|
||||
List<String> F = Files.readAllLines(Paths.get(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_fonts"), Charset.forName("UTF-8"));
|
||||
for (String s : F)
|
||||
{
|
||||
font_map.add(new Font (s));
|
||||
}
|
||||
|
||||
List<String> G = Files.readAllLines(Paths.get(System.getProperty("user.home") + File.separator + ".idp_scheme/.ui_gradients"), Charset.forName("UTF-8"));
|
||||
for (String s : G)
|
||||
{
|
||||
gradient_map.add(new Gradient (s));
|
||||
}
|
||||
|
||||
|
||||
System.out.println("=============== <COLOR MAP> ===============");
|
||||
for (int i = 0; i < color_map.size(); i ++)
|
||||
{
|
||||
System.out.println(i + " : " + color_map.get(i));
|
||||
UIManager.put(color_map.get(i).getName(), color_map.get(i).getObject());
|
||||
}
|
||||
System.out.println("=============== <FONT MAP> ===============");
|
||||
for (int i = 0; i < font_map.size(); i ++)
|
||||
{
|
||||
System.out.println(i + " : " + font_map.get(i));
|
||||
UIManager.put(font_map.get(i).getName(), font_map.get(i).getObject());
|
||||
}
|
||||
System.out.println("=============== <GRADIENT MAP> ===============");
|
||||
for (int i = 0; i < gradient_map.size(); i ++)
|
||||
{
|
||||
System.out.println(i + " : " + gradient_map.get(i));
|
||||
}
|
||||
|
||||
|
||||
// CheckBox.border CLASS:
|
||||
//javax.swing.plaf.BorderUIResource$CompoundBorderUIResource
|
||||
//
|
||||
//VALUE:
|
||||
//javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@60e359e2
|
||||
|
||||
Object borderGP = UIManager.get("Button.border");
|
||||
System.err.println("bgp = " + borderGP);
|
||||
System.err.println("bgp2 = " + borderGP.getClass());
|
||||
System.err.println("bgp3 = " + borderGP.getClass().getSuperclass());
|
||||
|
||||
Border inner_border = new javax.swing.border.LineBorder(new java.awt.Color(48, 48, 48), 1);
|
||||
Border outter_border = new javax.swing.border.LineBorder(new java.awt.Color(16, 16, 16), 2);
|
||||
|
||||
javax.swing.border.AbstractBorder brd = new javax.swing.border.CompoundBorder(outter_border,inner_border);
|
||||
|
||||
UIManager.put("Button.border", brd);
|
||||
|
||||
Object [] keys = new Object[UIManager.getLookAndFeelDefaults().keySet().size()];
|
||||
// UIManager.put("Tree.textForeground", new javax.swing.plaf.ColorUIResource(0,255,0));
|
||||
// This is F*CKIN VOODOO MAGIC... aaaaaaaaa, I'm just as black cat in a night
|
||||
|
||||
//System.setProperty("awt.useSystemAAFontSettings", "on");
|
||||
|
||||
System.setProperty("awt.useSystemAAFontSettings","lcd");
|
||||
System.setProperty("swing.aatext", "true");
|
||||
System.setProperty("nb.useSwingHtmlRendering", "true");
|
||||
|
||||
String nb_home = System.getProperty("netbeans.home");
|
||||
String nb_conf = nb_home.substring(0, nb_home.length() - "platform".length()) + "etc" + File.separator;
|
||||
|
||||
File conf = new File (nb_conf);
|
||||
Path path = FileSystems.getDefault().getPath(nb_conf, "netbeans.conf");
|
||||
List<String> linesL = Files.readAllLines(path);
|
||||
String [] lines = new String[linesL.size()];
|
||||
|
||||
int i = 0;
|
||||
for (String str : linesL)
|
||||
{
|
||||
lines[i] = str;
|
||||
i++;
|
||||
}
|
||||
|
||||
for (i =0; i < lines.length; i ++)
|
||||
{
|
||||
if (lines[i].contains("netbeans_default_options="))
|
||||
{
|
||||
System.out.println("Fond default settings line!");
|
||||
if (!lines[i].contains("-J-Dawt.useSystemAAFontSettings"))
|
||||
{
|
||||
System.out.println("No rendering hints defined - fixing...");
|
||||
String [] parts = lines[i].split("\"");
|
||||
String new_line = parts[0] + "\"" + parts[1] + " -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd" + "\"";
|
||||
lines[i] = new_line;
|
||||
System.out.println(">>> " + lines[i]);
|
||||
|
||||
writeFile1(nb_conf + "netbeans.conf", lines);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Font redering hints already set - OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Properties properties = System.getProperties();
|
||||
// for (Object o : properties.keySet())
|
||||
// {
|
||||
// System.out.println( o + " : " + properties.getProperty((String) o));
|
||||
// }
|
||||
// NodeRenderer nr = NodeRenderer.sharedInstance();
|
||||
// Field[] fields = nr.getClass().getFields();
|
||||
// for (int i = 0; i < fields.length; i ++)
|
||||
// {
|
||||
// System.out.println(">>> " + fields[i]);
|
||||
// }
|
||||
//public static NodeRenderer sharedInstance()
|
||||
//
|
||||
|
||||
|
||||
UIManager.put("TabbedPane.borderColor", java.awt.Color.RED);
|
||||
UIManager.put("TabbedPane.darkShadow", ColorUIResource.RED);
|
||||
UIManager.put("TabbedPane.light", ColorUIResource.RED);
|
||||
UIManager.put("TabbedPane.highlight", ColorUIResource.RED);
|
||||
UIManager.put("TabbedPane.focus", ColorUIResource.RED);
|
||||
UIManager.put("TabbedPane.unselectedBackground", ColorUIResource.RED);
|
||||
UIManager.put("TabbedPane.selectHighlight", ColorUIResource.RED);
|
||||
UIManager.put("TabbedPane.tabAreaBackground", ColorUIResource.RED);
|
||||
UIManager.put("TabbedPane.borderHightlightColor", ColorUIResource.RED);
|
||||
|
||||
UIManager.put("Focus.color", ColorUIResource.RED);
|
||||
|
||||
|
||||
UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));
|
||||
|
||||
|
||||
//"window" theme.getWindowBackground()
|
||||
//"windowBorder" theme.getControl()
|
||||
//"windowText" theme.getUserTextColor()
|
||||
//"menu" theme.getMenuBackground()
|
||||
//"menuText" theme.getMenuForeground()
|
||||
//"text" theme.getWindowBackground()
|
||||
//"textText" theme.getUserTextColor()
|
||||
//"textHighlight" theme.getTextHighlightColor()
|
||||
//"textHighlightText" theme.getHighlightedTextColor()
|
||||
//"textInactiveText" theme.getInactiveSystemTextColor()
|
||||
//"control" theme.getControl()
|
||||
//"controlText" theme.getControlTextColor()
|
||||
//"controlHighlight" theme.getControlHighlight()
|
||||
//"controlLtHighlight" theme.getControlHighlight()
|
||||
//"controlShadow" theme.getControlShadow()
|
||||
//"controlDkShadow" theme.getControlDarkShadow()
|
||||
//"scrollbar" theme.getControl()
|
||||
//"info" theme.getPrimaryControl()
|
||||
//"infoText" theme.getPrimaryControlInfo()
|
||||
//The value theme corresponds to the current MetalTheme.
|
||||
|
||||
// UIManager.put("desktop", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("activeCaption", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("activeCaptionText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("activeCaptionBorder", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("inactiveCaption", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("inactiveCaptionText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("inactiveCaptionBorder", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("window", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("windowBorder", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("windowText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("menu", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("menuText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("text", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("textText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("textHighlight", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("textHighlightText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("textInactiveText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("control", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("controlText", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("controlHighlight", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("controlLtHighlight", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("controlShadow", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("controlDkShadow", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("scrollbar", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("info", new ColorUIResource(java.awt.Color.red));
|
||||
// UIManager.put("infoText", new ColorUIResource(java.awt.Color.red));
|
||||
|
||||
|
||||
System.out.println("===================================");
|
||||
System.out.println("===================================");
|
||||
System.out.println("===================================");
|
||||
|
||||
for (int k = 0; k < Keys.keys.length; k ++)
|
||||
{
|
||||
|
||||
Object o = UIManager.get(Keys.keys[k]);
|
||||
if (o != null)
|
||||
{
|
||||
// if (o.getClass() == javax.swing.plaf.ColorUIResource.class)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
System.out.println(Keys.keys[k] + " : " + o.getClass() + " >> " + o );
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println(Keys.keys[k] + " >> NULL");
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^");
|
||||
|
||||
repaintUI();
|
||||
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void writeFile1(String path, String [] data) throws IOException {
|
||||
|
||||
File fout = new File(path);
|
||||
FileOutputStream fos = new FileOutputStream(fout);
|
||||
|
||||
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
|
||||
|
||||
for (int i = 0; i < data.length; i ++) {
|
||||
bw.write(data[i]);
|
||||
bw.newLine();
|
||||
}
|
||||
|
||||
bw.close();
|
||||
}
|
||||
|
||||
private static void repaintUI()
|
||||
{
|
||||
SwingUtilities.updateComponentTreeUI(WindowManager.getDefault().getMainWindow());
|
||||
WindowManager.getDefault().getMainWindow().pack();
|
||||
WindowManager.getDefault().getMainWindow().repaint();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
# To change this license header, choose License Headers in Project Properties.
|
||||
# To change this template file, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
Editor.title=[idp!] Color Editor
|
||||
@ -0,0 +1,44 @@
|
||||
/* Copyright (C) Edward M. Kagan - All Rights Reserved
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
* Proprietary and confidential
|
||||
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015
|
||||
*/
|
||||
package org.idp.laf.gui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionRegistration;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.windows.WindowManager;
|
||||
|
||||
/**
|
||||
* @author Edward M. Kagan <pagan@idp-crew.com>
|
||||
*/
|
||||
|
||||
@ActionID(
|
||||
category = "File",
|
||||
id = "org.idp.laf.ColorEditorActionListener"
|
||||
)
|
||||
@ActionRegistration(
|
||||
iconBase = "org/idp/laf/gui/wh.png",
|
||||
displayName = "#CTL_ColorEditorActionListener"
|
||||
)
|
||||
@ActionReference(path = "Toolbars/File", position = -100)
|
||||
@Messages("CTL_ColorEditorActionListener=[idp!] Color Editor")
|
||||
public final class ColorEditorActionListener implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ColorEditorTopComponent editor = (ColorEditorTopComponent) WindowManager.getDefault().findTopComponent("ColorEditorTopComponent");
|
||||
if (editor.isOpened())
|
||||
{
|
||||
editor.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
editor.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.4" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Form>
|
||||
@ -0,0 +1,97 @@
|
||||
/* Copyright (C) Edward M. Kagan - All Rights Reserved
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
* Proprietary and confidential
|
||||
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015
|
||||
*/
|
||||
package org.idp.laf.gui;
|
||||
|
||||
import org.netbeans.api.settings.ConvertAsProperties;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
|
||||
/**
|
||||
* @author Edward M. Kagan <pagan@idp-crew.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Top component which displays something.
|
||||
*/
|
||||
@ConvertAsProperties(
|
||||
dtd = "-//org.idp.laf.gui//ColorEditor//EN",
|
||||
autostore = false
|
||||
)
|
||||
@TopComponent.Description(
|
||||
preferredID = "ColorEditorTopComponent",
|
||||
iconBase = "org/idp/laf/gui/wh.png",
|
||||
persistenceType = TopComponent.PERSISTENCE_ALWAYS
|
||||
)
|
||||
@TopComponent.Registration(mode = "editor", openAtStartup = false)
|
||||
@ActionID(category = "Window", id = "org.idp.laf.gui.ColorEditorTopComponent")
|
||||
@ActionReference(path = "Menu/Window" /*, position = 333 */)
|
||||
@TopComponent.OpenActionRegistration(
|
||||
displayName = "#CTL_ColorEditorAction",
|
||||
preferredID = "ColorEditorTopComponent"
|
||||
)
|
||||
@Messages({
|
||||
"CTL_ColorEditorAction=ColorEditor",
|
||||
"CTL_ColorEditorTopComponent=ColorEditor Window",
|
||||
"HINT_ColorEditorTopComponent=This is a ColorEditor window"
|
||||
})
|
||||
public final class ColorEditorTopComponent extends TopComponent {
|
||||
|
||||
public ColorEditorTopComponent() {
|
||||
initComponents();
|
||||
setName(Bundle.CTL_ColorEditorTopComponent());
|
||||
setToolTipText(Bundle.HINT_ColorEditorTopComponent());
|
||||
putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
|
||||
putClientProperty(TopComponent.PROP_DRAGGING_DISABLED, Boolean.TRUE);
|
||||
putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED, Boolean.TRUE);
|
||||
putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 400, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 300, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
@Override
|
||||
public void componentOpened() {
|
||||
// TODO add custom code on component opening
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentClosed() {
|
||||
// TODO add custom code on component closing
|
||||
}
|
||||
|
||||
void writeProperties(java.util.Properties p) {
|
||||
// better to version settings since initial version as advocated at
|
||||
// http://wiki.apidesign.org/wiki/PropertyFiles
|
||||
p.setProperty("version", "1.0");
|
||||
// TODO store your settings
|
||||
}
|
||||
|
||||
void readProperties(java.util.Properties p) {
|
||||
String version = p.getProperty("version");
|
||||
// TODO read your settings according to their version
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf.settings;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
import static org.idp.laf.settings.Color.ColorClass.AT;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SF;
|
||||
import static org.idp.laf.settings.Color.ColorClass.SS;
|
||||
import static org.idp.laf.settings.Font.FontClass.FA;
|
||||
import static org.idp.laf.settings.Font.FontClass.FS;
|
||||
import sun.swing.PrintColorUIResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class Font implements Serializable{
|
||||
|
||||
public enum FontClass {
|
||||
FS (javax.swing.plaf.FontUIResource.class),
|
||||
FA (java.awt.Font.class);
|
||||
|
||||
private final Class cls;
|
||||
|
||||
FontClass(Class cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
public Class getClazz()
|
||||
{
|
||||
return this.cls;
|
||||
}
|
||||
}
|
||||
|
||||
String family;
|
||||
String name;
|
||||
int style;
|
||||
int size;
|
||||
String pname;
|
||||
FontClass cls;
|
||||
|
||||
|
||||
public Font(String pname, FontClass cls, String family, String name, int style, int size) {
|
||||
this.family = family;
|
||||
this.name = name;
|
||||
this.size = size;
|
||||
this.style = style;
|
||||
this.pname = pname;
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "F[" + this.pname + ":" + this.cls + ":" + family + "," + name + "," + size + "," + style + "]";
|
||||
}
|
||||
|
||||
public Font (String str)
|
||||
{
|
||||
if (str.startsWith("F"))
|
||||
{
|
||||
String real = str.substring(2, str.length() - 1);
|
||||
String [] vals = real.split(":");
|
||||
|
||||
this.pname = vals[0];
|
||||
if (vals[1].equals("FS"))
|
||||
{
|
||||
this.cls = FS;
|
||||
}
|
||||
else if (vals[1].equals("FA"))
|
||||
{
|
||||
this.cls = FA;
|
||||
}
|
||||
|
||||
vals = vals[2].split(",");
|
||||
|
||||
|
||||
this.family = vals[0];
|
||||
this.name = vals[1];
|
||||
this.size = Integer.parseInt(vals[2]);
|
||||
this.style = Integer.parseInt(vals[3]);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("FUCK OFF - poor format");
|
||||
}
|
||||
}
|
||||
|
||||
public Object getObject ()
|
||||
{
|
||||
java.awt.Font ff = new java.awt.Font(name, style, size);
|
||||
|
||||
switch (this.cls)
|
||||
{
|
||||
case FS : {
|
||||
javax.swing.plaf.FontUIResource res = new FontUIResource(ff);
|
||||
return res;
|
||||
}
|
||||
case FA : {
|
||||
return ff;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getName() {
|
||||
return this.pname;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.idp.laf.settings;
|
||||
|
||||
import java.io.Serializable;
|
||||
import static org.idp.laf.settings.Font.FontClass.FA;
|
||||
import static org.idp.laf.settings.Font.FontClass.FS;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Edward M. Kagan <root@paganware.com>
|
||||
*/
|
||||
public class Gradient implements Serializable{
|
||||
|
||||
String pname;
|
||||
float I;
|
||||
float J;
|
||||
Color A;
|
||||
Color B;
|
||||
Color C;
|
||||
|
||||
public Gradient(String pname, float I, float J, Color A, Color B, Color C) {
|
||||
this.pname = pname;
|
||||
this.I = I;
|
||||
this.J = J;
|
||||
this.A = A;
|
||||
this.B = B;
|
||||
this.C = C;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "G[" + this.pname + ";" + I + ";" + J + ";" + A.toString() + ";" + B.toString() + ";" + C.toString() + "]";
|
||||
}
|
||||
|
||||
public Gradient (String str)
|
||||
{
|
||||
if (str.startsWith("G"))
|
||||
{
|
||||
String real = str.substring(2, str.length() - 1);
|
||||
String [] vals = real.split(";");
|
||||
|
||||
this.pname = vals[0];
|
||||
System.out.println(">>" + vals[1]);
|
||||
this.I = Float.parseFloat(vals[1]);
|
||||
this.J = Float.parseFloat(vals[2]);
|
||||
this.A = new Color(vals[3]);
|
||||
this.B = new Color(vals[4]);
|
||||
this.C = new Color(vals[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println("FUCK OFF - poor format");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue