本文整理汇总了Java中javax.swing.JFrame.setUndecorated方法的典型用法代码示例。如果您正苦于以下问题:Java JFrame.setUndecorated方法的具体用法?Java JFrame.setUndecorated怎么用?Java JFrame.setUndecorated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.setUndecorated方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showSplash
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* Method showSplash.
*/
private void showSplash() {
splash = new JFrame();
ImageIcon spl =
new ImageIcon(App.class.getResource("resources/splash.png"));
JLabel l = new JLabel();
l.setSize(400, 300);
l.setIcon(spl);
splash.getContentPane().add(l);
splash.setSize(400, 300);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
splash.setLocation(
(screenSize.width - 400) / 2,
(screenSize.height - 300) / 2);
splash.setUndecorated(true);
splash.setVisible(true);
}
示例2: SplashScreen
import javax.swing.JFrame; //导入方法依赖的package包/类
public SplashScreen(Image productLogo, Properties properties) {
this.properties = properties;
this.productLogo = productLogo;
this.productName = I18N.getGUIMessage("gui.splash.product_name");
splashScreenFrame = new JFrame(properties.getProperty("name"));
splashScreenFrame.getContentPane().add(this);
SwingTools.setFrameIcon(splashScreenFrame);
splashScreenFrame.setUndecorated(true);
if (backgroundImage != null) {
splashScreenFrame.setSize(backgroundImage.getWidth(this), backgroundImage.getHeight(this));
} else {
splashScreenFrame.setSize(550, 400);
}
splashScreenFrame.setLocationRelativeTo(null);
animationTimer = new Timer(10, this);
animationTimer.setRepeats(true);
animationTimer.start();
}
示例3: showSplash
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* Method showSplash.
*/
private void showSplash() {
splash = new JFrame();
ImageIcon spl =
new ImageIcon(App.class.getResource("/ui/splash.png"));
JLabel l = new JLabel();
l.setSize(400, 300);
l.setIcon(spl);
splash.getContentPane().add(l);
splash.setSize(400, 300);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
splash.setLocation(
(screenSize.width - 400) / 2,
(screenSize.height - 300) / 2);
splash.setUndecorated(true);
splash.setVisible(true);
}
示例4: main
import javax.swing.JFrame; //导入方法依赖的package包/类
public static void main(String[] args) {
// Main method
Main m = new Main(); // Create the game object
Main.m = m;
frame = new JFrame("Game");
frame.setResizable(false);
frame.setUndecorated(true);
frame.add(m.canvas);
frame.pack();
frame.addWindowListener(m);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.requestFocus();
m.start();
}
示例5: showSplash
import javax.swing.JFrame; //导入方法依赖的package包/类
/**
* Method showSplash.
*/
private void showSplash() {
splash = new JFrame();
ImageIcon spl =
new ImageIcon(App.class.getResource("resources/splash.png"));
JLabel jl = new JLabel();
jl.setSize(400, 300);
jl.setIcon(spl);
splash.getContentPane().add(jl);
splash.setSize(400, 300);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
splash.setLocation(
(screenSize.width - 400) / 2,
(screenSize.height - 300) / 2);
splash.setUndecorated(true);
splash.setVisible(true);
}
示例6: setDefaultMenuBar
import javax.swing.JFrame; //导入方法依赖的package包/类
void setDefaultMenuBar(final JMenuBar menuBar) {
installDefaultMenuBar(menuBar);
// scan the current frames, and see if any are foreground
final Frame[] frames = Frame.getFrames();
for (final Frame frame : frames) {
if (frame.isVisible() && !isFrameMinimized(frame)) {
return;
}
}
// if we have no foreground frames, then we have to "kick" the menubar
final JFrame pingFrame = new JFrame();
pingFrame.getRootPane().putClientProperty("Window.alpha", Float.valueOf(0.0f));
pingFrame.setUndecorated(true);
pingFrame.setVisible(true);
pingFrame.toFront();
pingFrame.setVisible(false);
pingFrame.dispose();
}
示例7: createUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createUI() {
frame = new JFrame();
frame.setUndecorated(true);
frame.setSize(300, 300);
frame.setLocationRelativeTo(null);
final JDesktopPane pane = new JDesktopPane();
final JPanel panel = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
g.setColor(color);
g.fillRect(0, 0, getWidth(), getHeight());
}
};
jif = new JInternalFrame();
jif.add(panel);
jif.setVisible(true);
jif.setSize(300, 300);
pane.add(jif);
frame.add(pane);
frame.setVisible(true);
}
示例8: initializeFrame
import javax.swing.JFrame; //导入方法依赖的package包/类
public void initializeFrame(){
// Main frame
f = new JFrame("Dynamic Simulation Display");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(DYNAMIC_FRAME_WIDTH, DYNAMIC_FRAME_HEIGHT);
f.setUndecorated(true);
f.setBackground(Color.BLACK);
f.setLayout(null);
f.setLocationRelativeTo(null);
f.setResizable(false);
f.add(new JLabel("test label"));
// Add the dynamic track view panel
f.add(dynamicTrackView);
dynamicTrackView.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
dynamicTrackView.showArrows = !dynamicTrackView.showArrows;
dynamicTrackView.refresh();
}
});
}
示例9: run
import javax.swing.JFrame; //导入方法依赖的package包/类
@Override
public void run() {
final JMenuBar menubar = new JMenuBar();
menubar.add(new JMenu(""));
menubar.add(new JMenu(""));
final JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setJMenuBar(menubar);
frame.setSize(W / 3, H / 3);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
// draw menu bar using standard order.
final BufferedImage bi1 = step1(menubar);
// draw menu border on top of the menu bar, nothing should be changed.
final BufferedImage bi2 = step2(menubar);
frame.dispose();
for (int x = 0; x < W; ++x) {
for (int y = 0; y < H; ++y) {
if (bi1.getRGB(x, y) != bi2.getRGB(x, y)) {
try {
ImageIO.write(bi1, "png", new File("image1.png"));
ImageIO.write(bi2, "png", new File("image2.png"));
} catch (IOException e) {
e.printStackTrace();
}
throw new RuntimeException("Failed: wrong color");
}
}
}
}
示例10: createAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private static void createAndShowGUI() {
demoFrame = new JFrame();
demoFrame.setSize(300, 300);
demoFrame.setLayout(new FlowLayout());
demoFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
demoFrame.setUndecorated(true);
demoFrame.setBackground(new Color(0f, 0, 0, 0.1f));
JCheckBox b = new JCheckBox("Whatever");
demoFrame.paintAll(null);
b.setOpaque(true);
demoFrame.add(b);
demoFrame.add(new JButton());
demoFrame.setVisible(true);
}
示例11: initAndShowGUI
import javax.swing.JFrame; //导入方法依赖的package包/类
private void initAndShowGUI() {
JFrame w = new JFrame();
w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
if (!QConfig.cfg().isDebug()) {
w.setUndecorated(true);
}
// Create JavaFX panel.
/* todo
javafxPanel = new JFXPanel();
javafxPanel.setPreferredSize(new Dimension(win_w, win_h));
w.getContentPane().add(javafxPanel, BorderLayout.CENTER);
*
*/
initFXscene();
// Show frame.
w.pack();
w.setLocationRelativeTo(null);
w.setVisible(true);
if (QConfig.cfg().isDebug()) {
w.setBounds(100, 100, 1024, 768);
} else {
w.setBounds(win_x, win_y, win_w, win_h);
w.setAlwaysOnTop(true);
}
}
示例12: displayCalibrationStatus
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void displayCalibrationStatus(JFrame frame) throws Exception {
double[] pointsNormalized = jniGetCalibration();
if (pointsNormalized == null)
throw new IOException("Can't get calibration data!");
int zeros = 0;
for( double ord: pointsNormalized){
if( ord <= 0 || ord > 1) zeros++;
}
ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
int itemCount = pointsNormalized.length/4;
for( int i=0; i < itemCount; i++ ){
points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
}
Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
for(Point2D.Double p: points){
if( !rect.contains(p) ) invalidpoints.add(p);
}
for (int i = 0; i < pointsNormalized.length; i++) {
if (pointsNormalized[i] < 0.0001) {
pointsNormalized[i] = 0.0001;
} else if (pointsNormalized[i] > 0.9999) {
pointsNormalized[i] = 0.9999;
} else {
//do nothing
}
}
Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
for (int j = 0; j < itemCount; j+=2) {
calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
if(j != itemCount)
calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
}
JFrame calibFrame = frame;
CalibrationStatusDisplay calibDisplay =
new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
calibFrame.add(calibDisplay);
calibFrame.setUndecorated(false);
calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
calibFrame.setMinimumSize(new Dimension(600,300));
calibFrame.setTitle("Calibration: "+new Date());
Insets insets = calibFrame.getInsets();
int width = calibFrame.getSize().width-(insets.left+insets.right);
int height = calibFrame.getSize().height-(insets.top+insets.bottom);
calibDisplay.windowDimension = new Dimension(width,height);
calibFrame.setVisible(true);
calibFrame.toFront();
calibDisplay.repaint();
}
示例13: displayCalibrationStatus
import javax.swing.JFrame; //导入方法依赖的package包/类
protected void displayCalibrationStatus(JFrame frame) throws Exception {
double[] pointsNormalized = jniGetCalibration();
if (pointsNormalized == null)
throw new IOException("Can't get calibration data!");
int zeros = 0;
for( double ord: pointsNormalized){
if( ord <= 0 || ord > 1) zeros++;
}
ArrayList<Point2D.Double> points = new ArrayList<Point2D.Double>();
ArrayList<Point2D.Double> invalidpoints = new ArrayList<Point2D.Double>();
//if( zeros > 0 ) throw new IOException("zeros in points: "+zeros+"/"+pointsNormalized.length);
int itemCount = pointsNormalized.length/4;
for( int i=0; i < itemCount; i++ ){
points.add(new Point2D.Double(pointsNormalized[i],pointsNormalized[i+itemCount]));
points.add(new Point2D.Double(pointsNormalized[(2*itemCount)+i],pointsNormalized[i+(itemCount*3)]));
}
Rectangle2D.Double rect = new Rectangle2D.Double(0.0,0.0,1.0,1.0);
for(Point2D.Double p: points){
if( !rect.contains(p) ) invalidpoints.add(p);
}
for (int i = 0; i < pointsNormalized.length; i++) {
if (pointsNormalized[i] < 0.0001) {
pointsNormalized[i] = 0.0001;
} else if (pointsNormalized[i] > 0.9999) {
pointsNormalized[i] = 0.9999;
} else {
//do nothing
}
}
Point2D.Double[] calibrationData = new Point2D.Double[itemCount+1];
for (int j = 0; j < itemCount; j+=2) {
calibrationData[j] = (new Point2D.Double(pointsNormalized[j],pointsNormalized[itemCount+j]));
if(j != itemCount)
calibrationData[j+1] = (new Point2D.Double(pointsNormalized[2*itemCount+j],pointsNormalized[3*itemCount+j]));
}
JFrame calibFrame = frame;
CalibrationStatusDisplay calibDisplay =
new CalibrationStatusDisplay(calibFrame,calibrationPoints,calibrationData);
calibFrame.add(calibDisplay);
calibFrame.setUndecorated(false);
calibFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
calibFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
calibFrame.setMinimumSize(new Dimension(600,300));
calibFrame.setTitle("Calibration: "+new Date());
Insets insets = calibFrame.getInsets();
int width = calibFrame.getSize().width-(insets.left+insets.right);
int height = calibFrame.getSize().height-(insets.top+insets.bottom);
calibDisplay.windowDimension = new Dimension(width,height);
calibFrame.setVisible(true);
calibDisplay.repaint();
}