当前位置: 首页>>代码示例>>Java>>正文


Java HeadlessException类代码示例

本文整理汇总了Java中java.awt.HeadlessException的典型用法代码示例。如果您正苦于以下问题:Java HeadlessException类的具体用法?Java HeadlessException怎么用?Java HeadlessException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HeadlessException类属于java.awt包,在下文中一共展示了HeadlessException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createInputMethodWindow

import java.awt.HeadlessException; //导入依赖的package包/类
static Window createInputMethodWindow(String title, InputContext context, boolean isSwing) {
    if (GraphicsEnvironment.isHeadless()) {
        throw new HeadlessException();
    }
    if (isSwing) {
        return new InputMethodJFrame(title, context);
    } else {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        if (toolkit instanceof InputMethodSupport) {
            return ((InputMethodSupport)toolkit).createInputMethodWindow(
                title, context);
        }
    }
    throw new InternalError("Input methods must be supported");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:InputMethodContext.java

示例2: main

import java.awt.HeadlessException; //导入依赖的package包/类
public static void main(final String[] args) throws HeadlessException {
    final Frame frame = new Frame("Test Frame");
    final List list = new List();
    frame.setSize(300, 200);
    list.add(ITEM_NAME);
    list.select(0);
    frame.add(list);
    frame.validate();
    frame.setVisible(true);
    sleep();
    if (!ITEM_NAME.equals(list.getSelectedItem())) {
        throw new RuntimeException("List item not selected item.");
    }
    list.removeAll();
    frame.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:R2303044ListSelection.java

示例3: createDialog

import java.awt.HeadlessException; //导入依赖的package包/类
private JDialog createDialog(Component parentComponent, String title,
        int style)
        throws HeadlessException {

    final JDialog dialog;

    Window window = JOptionPane.getWindowForComponent(parentComponent);
    if (window instanceof Frame) {
        dialog = new JDialog((Frame)window, title, true);
    } else {
        dialog = new JDialog((Dialog)window, title, true);
    }
    if (window instanceof SwingUtilities.SharedOwnerFrame) {
        WindowListener ownerShutdownListener =
                SwingUtilities.getSharedOwnerFrameShutdownListener();
        dialog.addWindowListener(ownerShutdownListener);
    }
    initDialog(dialog, style, parentComponent);
    return dialog;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:JOptionPane.java

示例4: TestFrame

import java.awt.HeadlessException; //导入依赖的package包/类
public TestFrame(int width, int height, boolean undecorated) throws HeadlessException {
    super("Test Frame. Undecorated: " + undecorated);
    setSize(width, height);
    mrImage = new TestMultiResolutionImage(width, height);

    setUndecorated(undecorated);
    Panel panel = new Panel(new FlowLayout()) {
        @Override
        public void paint(Graphics g) {
            super.paint(g);
            AffineTransform tx = ((Graphics2D) g).getTransform();
            mrImage.scaleX = tx.getScaleX();
            mrImage.scaleY = tx.getScaleY();
            Insets insets = getInsets();
            g.drawImage(mrImage, insets.left, insets.bottom, null);
        }
    };
    add(panel);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:WindowResizingOnDPIChangingTest.java

示例5: getEncryptAction

import java.awt.HeadlessException; //导入依赖的package包/类
private static AbstractAction getEncryptAction(final JTable table) {
    return new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent me) {
            try {
                int col = table.getSelectedColumn();
                int row = table.getSelectedRow();
                if (col > -1 && row > -1) {
                    String data = table.getValueAt(row, col).toString();
                    table.setValueAt(TMIntegration.encrypt(data), row, col);
                }
            } catch (HeadlessException ex) {
                Logger.getLogger(TMSettingsControl.class.getName())
                        .log(Level.SEVERE, ex.getMessage(), ex);
            }

        }
    };
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:20,代码来源:TMSettingsControl.java

示例6: btn_deleteActionPerformed

import java.awt.HeadlessException; //导入依赖的package包/类
private void btn_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_deleteActionPerformed
    // untuk table delete.

    try {
        String sql = "DELETE FROM Product WHERE Prod_id ='" + txt_idProduct.getText() + "'";
        java.sql.Connection conn = (java.sql.Connection) apsari.Koneksi.koneksiDB();
        java.sql.PreparedStatement pst = conn.prepareStatement(sql);
        pst.execute();
        JOptionPane.showMessageDialog(null, "Data akan dihapus?");
        databaru = true;
        //kosongkan editor kiri
        txt_idProduct.setText("");
        txt_namaProduct.setText("");
        txt_hargaProduct.setText("");

    } catch (SQLException | HeadlessException e) {

    }
    GetData();
}
 
开发者ID:azzamsa,项目名称:steller,代码行数:21,代码来源:TokoEditorForm1.java

示例7: AppScannerInterface

import java.awt.HeadlessException; //导入依赖的package包/类
public AppScannerInterface() {
    super();
    initialize();
    try {
        scanner = Scanner.getDevice();
        //--
        if (BoshScan.verifyAndInitComponets(scanner)) {
            boshScanListener = new BoshScanListener();
            //--
            scanner.addListener(boshScanListener);
        } else {
            JOptionPane.showMessageDialog(null, "No cumple con los requerimientos necesarios para \nusar twain4J", "Error", JOptionPane.ERROR_MESSAGE);
        }
        //--
    } catch (HeadlessException e) {
        System.out.println(e.getMessage());
    }
}
 
开发者ID:nrreal,项目名称:twainBDirect,代码行数:19,代码来源:AppScannerInterface.java

示例8: btn_saveActionPerformed

import java.awt.HeadlessException; //导入依赖的package包/类
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_saveActionPerformed
    try {
        JFileChooser jfc = new JFileChooser();
        jfc.setDialogTitle("Registerauszug speichern");
        jfc.setFileFilter(new FileNameExtensionFilter("TEXT FILES", "txt", "text"));
        if (jfc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
            File f = jfc.getSelectedFile();
            FileWriter fw = new FileWriter(f);
            BufferedWriter bw = new BufferedWriter(fw);
            DataSetter ds = new DataSetter();
            ds.writeToFile(bw, it);
        }
    } catch (HeadlessException | IOException e) {
        JOptionPane.showMessageDialog(this, "Error: IO");
    }
}
 
开发者ID:froehlichA,项目名称:RA-Reader,代码行数:17,代码来源:RegisterAuszugGUI.java

示例9: setSavingImage

import java.awt.HeadlessException; //导入依赖的package包/类
/**
 * @param savingImage the savingImage to set
 */
public void setSavingImage(boolean savingImage) {
    if (savingImage == true) {
        try {
            // Repeat the SavingImageTask without delay and with 5000ms between executions
            JFileChooser f = new JFileChooser();
            f.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            int state = f.showSaveDialog(null);
            if (state == JFileChooser.APPROVE_OPTION) {
                savingImageTimer = new java.util.Timer();
                savingImageTimer.scheduleAtFixedRate(new SaveImageTask(f.getSelectedFile()), 0, 5000);
            }
        } catch (HeadlessException e) {//Catch exception if any
            log.warning("Error: " + e.getMessage());
        }
    } else {
        savingImageTimer.cancel();
        savingImageTimer = null;
    }
    this.savingImage = savingImage;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:24,代码来源:ImageCreatorSlave.java

示例10: getDesktop

import java.awt.HeadlessException; //导入依赖的package包/类
/**
 * Returns the <code>Desktop</code> instance of the current
 * browser context.  On some platforms the Desktop API may not be
 * supported; use the {@link #isDesktopSupported} method to
 * determine if the current desktop is supported.
 * @return the Desktop instance of the current browser context
 * @throws HeadlessException if {@link
 * GraphicsEnvironment#isHeadless()} returns {@code true}
 * @throws UnsupportedOperationException if this class is not
 * supported on the current platform
 * @see #isDesktopSupported()
 * @see java.awt.GraphicsEnvironment#isHeadless
 */
public static synchronized Desktop getDesktop(){
    if (GraphicsEnvironment.isHeadless()) throw new HeadlessException();
    if (!Desktop.isDesktopSupported()) {
        throw new UnsupportedOperationException("Desktop API is not " +
                                                "supported on the current platform");
    }

    sun.awt.AppContext context = sun.awt.AppContext.getAppContext();
    Desktop desktop = (Desktop)context.get(Desktop.class);

    if (desktop == null) {
        desktop = new Desktop();
        context.put(Desktop.class, desktop);
    }

    return desktop;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:Desktop.java

示例11: showOpenDialog

import java.awt.HeadlessException; //导入依赖的package包/类
@Override
public int showOpenDialog(Component parent) throws HeadlessException {
	int ret = super.showOpenDialog(parent);

	if (ret == APPROVE_OPTION)
		update();

	return ret;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:10,代码来源:LocatableFileChooser.java

示例12: showSaveDialog

import java.awt.HeadlessException; //导入依赖的package包/类
@Override
public int showSaveDialog(Component parent) throws HeadlessException {
	int ret = super.showSaveDialog(parent);

	if (ret == APPROVE_OPTION)
		update();

	return ret;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:10,代码来源:LocatableFileChooser.java

示例13: getScreenBounds

import java.awt.HeadlessException; //导入依赖的package包/类
private Rectangle getScreenBounds() throws HeadlessException {
  Rectangle virtualBounds = new Rectangle();
  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  GraphicsDevice[] gs = ge.getScreenDevices();

  if (gs.length == 0 || gs.length == 1) {
      return new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
  }
 
  for (GraphicsDevice gd : gs) {
      virtualBounds = virtualBounds.union(gd.getDefaultConfiguration().getBounds());
  }

  return virtualBounds;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:HintsUI.java

示例14: colorModel

import java.awt.HeadlessException; //导入依赖的package包/类
static private ColorModel colorModel(int transparency) {
    ColorModel model;
    try {
        model = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
            .getDefaultScreenDevice().getDefaultConfiguration()
            .getColorModel(transparency);
    }
    catch(HeadlessException he) {
        model = ColorModel.getRGBdefault();
    }

    return model;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DecorableTest.java

示例15: colorModel

import java.awt.HeadlessException; //导入依赖的package包/类
static private ColorModel colorModel(int transparency) {
    ColorModel model;
    try {
        model = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
            .getDefaultScreenDevice().getDefaultConfiguration()
            .getColorModel(transparency);
    }
    catch(ArrayIndexOutOfBoundsException aioobE) {
        //#226279
        model = ColorModel.getRGBdefault();
    } catch(HeadlessException he) {
        model = ColorModel.getRGBdefault();
    }
    return model;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ImageUtilities.java


注:本文中的java.awt.HeadlessException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。