誤解を招いて申し訳ありません。
だからそれも簡単です。
1)アプリ/重要なファイル/プロジェクトのプロパティを変更するには、次の行を追加します:
#実行用
run.args=-J-Dnetbeans.mainclass=splah.CustomStartup --nosplash
#IDE から実行する場合
run.args.extra=-J-Dnetbeans.mainclass=splah.CustomStartup --nosplash
2) プロジェクト JavaApplication スプラーとクラス CustomStartup を作成し、jar をビルドして dist から App/ にコピーします。
package splah;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.lang.reflect.Method;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JWindow;
public class CustomStartup {
private static final String NB_MAIN_CLASS = "org.netbeans.core.startup.Main";
private static final int width = 500, height = 400;
public static void main(String[] args) throws Exception {
// do whatever you need here (e.g. show a custom login form)
System.out.println("Hello world! I am a custom startup class");
JDialog splash = new JDialog();
splash.setUndecorated(true);
//
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
splash.setBounds(width, height, (screenSize.width-width)/2, (screenSize.height-height)/2);
splash.setVisible(true);
// once you're done with that, hand control back to NetBeans
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
Class<?> mainClass = Class.forName(NB_MAIN_CLASS, true, classloader);
Object mainObject = mainClass.newInstance();
Method mainMethod = mainClass.getDeclaredMethod("main", new Class[]{String[].class});
mainMethod.invoke(mainObject, (Object) args);
splash.setVisible(false);
}
}
クラスは私の頭からではありません。どこかで見つけましたが、どこにあるか覚えていません。
ジルカ