public void init() {
    initPins(0, 1, 0, 2);
    setSize(62, 40);
    element.jSetInnerBorderVisibility(false);
    element.jSetTopPinsVisible(false);
    element.jSetBottomPinsVisible(false);

    image = element.jLoadImage(element.jGetSourcePath() + "icon.gif");

    setPin(0, ExternalIF.C_VARIANT, element.PIN_OUTPUT);
    setPin(1, ExternalIF.C_VARIANT, element.PIN_INPUT);
    setPin(2, ExternalIF.C_BOOLEAN, element.PIN_INPUT);

    String strLocale = Locale.getDefault().toString();

    if (strLocale.equalsIgnoreCase("de_DE")) {
      element.jSetPinDescription(0, "Out");
      element.jSetPinDescription(1, "in");
      element.jSetPinDescription(2, "if (true) out=in");
    }
    if (strLocale.equalsIgnoreCase("en_US")) {
      element.jSetPinDescription(0, "Out");
      element.jSetPinDescription(1, "a");
      element.jSetPinDescription(2, "if (true) out=in");
    }
    if (strLocale.equalsIgnoreCase("es_ES")) {
      element.jSetPinDescription(0, "Salida");
      element.jSetPinDescription(1, "a");
      element.jSetPinDescription(2, "if (true) out=in");
    }

    setName("Abfrage2");
  }
 /** @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName */
 public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
   String name = "System Input Methods";
   if (Locale.getDefault().equals(displayLanguage)) {
     name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
   }
   return name;
 }
Beispiel #3
0
 public ExitAction(MainFrame main) {
   super();
   Locale locale = Locale.getDefault();
   bundle = ResourceBundle.getBundle(getClass().getName(), locale);
   this.main = main;
   putValue(NAME, bundle.getString("Exit"));
   putValue(MNEMONIC_KEY, new Integer(bundle.getString("Exit.mnemonic").charAt(0)));
 }
  static Object[] getAvailableLocalesInternal() {
    List workList = nativeGetAvailableLocales();

    if (workList != null) {
      return workList.toArray();
    }

    return new Object[] {Locale.getDefault()};
  }
 static {
   try {
     resources = ResourceBundle.getBundle("resources.TextViewer", Locale.getDefault());
   } catch (MissingResourceException mre) {
     String errstr = "TextViewer:resources/TextViewer.properties not found";
     // System.exit(1);
     System.err.println(errstr);
   }
 }
Beispiel #6
0
 static {
   try {
     properties = new Properties();
     properties.load(Notepad.class.getResourceAsStream("resources/NotepadSystem.properties"));
     resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault());
   } catch (MissingResourceException | IOException e) {
     System.err.println(
         "resources/Notepad.properties " + "or resources/NotepadSystem.properties not found");
     System.exit(1);
   }
 }
  /** Creates new form SwitchboardView */
  public SwitchboardView() {
    initComponents();

    btnSalesReport.addActionListener(this);
    btnBackOffice.addActionListener(this);
    btnClockOut.addActionListener(this);
    btnEditTicket.addActionListener(this);

    if (!"false".equals(AppConfig.getFeatureGroupTicketFlag())) {
      btnGroupSettle.addActionListener(this);
    }

    btnLogout.addActionListener(this);

    if (!"false".equals(AppConfig.getManagerMenuFlag())) {
      btnManager.addActionListener(this);
    }

    btnNewTicket.addActionListener(this);

    if (!"false".equals(AppConfig.getFeaturePenarikanFlag())) {
      btnPayout.addActionListener(this);
    }

    btnOrderInfo.addActionListener(this);
    btnReopenTicket.addActionListener(this);
    btnSettleTicket.addActionListener(this);
    btnShutdown.addActionListener(this);

    if (!"false".equals(AppConfig.getFeatureSplitTicketFlag())) {
      btnSplitTicket.addActionListener(this);
    }

    btnTakeout.addActionListener(this);
    btnVoidTicket.addActionListener(this);

    orderServiceExtension = Application.getPluginManager().getPlugin(OrderServiceExtension.class);

    if (orderServiceExtension == null) {
      //            btnHomeDelivery.setEnabled(false);
      //            btnPickup.setEnabled(false);
      //            btnDriveThrough.setEnabled(false);
      //            btnAssignDriver.setEnabled(false);
      //            btnCloseOrder.setEnabled(false);

      orderServiceExtension = new DefaultOrderServiceExtension();
    }
    //		ticketListUpdater = new Timer(30 * 1000, new TicketListUpdaterTask());

    applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));

    instance = this;
  }
  @Override
  public UIDefaults getDefaults() {
    try {
      final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults");
      superMethod.setAccessible(true);
      final UIDefaults metalDefaults = (UIDefaults) superMethod.invoke(new MetalLookAndFeel());

      final UIDefaults defaults = (UIDefaults) superMethod.invoke(base);
      if (SystemInfo.isLinux) {
        if (!Registry.is("darcula.use.native.fonts.on.linux")) {
          Font font = findFont("DejaVu Sans");
          if (font != null) {
            for (Object key : defaults.keySet()) {
              if (key instanceof String && ((String) key).endsWith(".font")) {
                defaults.put(key, new FontUIResource(font.deriveFont(13f)));
              }
            }
          }
        } else if (Arrays.asList("CN", "JP", "KR", "TW")
            .contains(Locale.getDefault().getCountry())) {
          for (Object key : defaults.keySet()) {
            if (key instanceof String && ((String) key).endsWith(".font")) {
              final Font font = defaults.getFont(key);
              if (font != null) {
                defaults.put(key, new FontUIResource("Dialog", font.getStyle(), font.getSize()));
              }
            }
          }
        }
      }

      LafManagerImpl.initInputMapDefaults(defaults);
      initIdeaDefaults(defaults);
      patchStyledEditorKit(defaults);
      patchComboBox(metalDefaults, defaults);
      defaults.remove("Spinner.arrowButtonBorder");
      defaults.put("Spinner.arrowButtonSize", JBUI.size(16, 5).asUIResource());
      MetalLookAndFeel.setCurrentTheme(createMetalTheme());
      if (SystemInfo.isWindows && Registry.is("ide.win.frame.decoration")) {
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);
      }
      if (SystemInfo.isLinux && JBUI.isHiDPI()) {
        applySystemFonts(defaults);
      }
      defaults.put("EditorPane.font", defaults.getFont("TextField.font"));
      return defaults;
    } catch (Exception e) {
      log(e);
    }
    return super.getDefaults();
  }
 protected void initResourceBundle(UIDefaults table) {
   // The following line of code does not work, when Quaqua has been loaded with
   // a custom class loader. That's why, we have to inject the labels
   // by ourselves:
   // table.addResourceBundle( "ch.randelshofer.quaqua.Labels" );
   ResourceBundle bundle =
       ResourceBundle.getBundle(
           "ch.randelshofer.quaqua.Labels", Locale.getDefault(), getClass().getClassLoader());
   for (Enumeration i = bundle.getKeys(); i.hasMoreElements(); ) {
     String key = (String) i.nextElement();
     table.put(key, bundle.getObject(key));
   }
 }
  /**
   * Create this dialog with the given parent and title.
   *
   * @param parent window from which this dialog is launched
   * @param title the title for the dialog box window
   * @since ostermillerutils 1.00.00
   */
  public PasswordDialog(Frame parent, String title) {

    super(parent, title, true);

    setLocale(Locale.getDefault());

    if (title == null) {
      setTitle(labels.getString("dialog.title"));
    }
    if (parent != null) {
      setLocationRelativeTo(parent);
    }
    // super calls dialogInit, so we don't need to do it again.
  }
 @JdkConstants.FontStyle
 static int getFontStyle(String fontName) {
   fontName = fontName.toLowerCase(Locale.getDefault());
   for (String name : BOLD_ITALIC_NAMES) {
     if (fontName.contains(name)) return Font.BOLD | Font.ITALIC;
   }
   for (String name : ITALIC_NAMES) {
     if (fontName.contains(name)) return Font.ITALIC;
   }
   for (String name : BOLD_NAMES) {
     if (fontName.contains(name)) return Font.BOLD;
   }
   return Font.PLAIN;
 }
Beispiel #12
0
 /** ** Gets the System default Locale ** @return The default Java Locale instance */
 public static Locale getDefaultLocale() {
   return Locale.getDefault(); // System default
 }
  /**
   * Called by constructors to initialize the dialog.
   *
   * @since ostermillerutils 1.00.00
   */
  @Override
  protected void dialogInit() {

    if (labels == null) {
      setLocale(Locale.getDefault());
    }

    name = new JTextField("", 20);
    pass = new JPasswordField("", 20);
    okButton = new JButton(labels.getString("dialog.ok"));
    cancelButton = new JButton(labels.getString("dialog.cancel"));
    nameLabel = new JLabel(labels.getString("dialog.name") + " ");
    passLabel = new JLabel(labels.getString("dialog.pass") + " ");

    super.dialogInit();

    KeyListener keyListener =
        (new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ESCAPE
                || (e.getSource() == cancelButton && e.getKeyCode() == KeyEvent.VK_ENTER)) {
              pressed_OK = false;
              PasswordDialog.this.setVisible(false);
            }
            if (e.getSource() == okButton && e.getKeyCode() == KeyEvent.VK_ENTER) {
              pressed_OK = true;
              PasswordDialog.this.setVisible(false);
            }
          }
        });
    addKeyListener(keyListener);

    ActionListener actionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Object source = e.getSource();
            if (source == name) {
              // the user pressed enter in the name field.
              name.transferFocus();
            } else {
              // other actions close the dialog.
              pressed_OK = (source == pass || source == okButton);
              PasswordDialog.this.setVisible(false);
            }
          }
        };

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    c.insets.top = 5;
    c.insets.bottom = 5;
    JPanel pane = new JPanel(gridbag);
    pane.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20));
    c.anchor = GridBagConstraints.EAST;
    gridbag.setConstraints(nameLabel, c);
    pane.add(nameLabel);

    gridbag.setConstraints(name, c);
    name.addActionListener(actionListener);
    name.addKeyListener(keyListener);
    pane.add(name);

    c.gridy = 1;
    gridbag.setConstraints(passLabel, c);
    pane.add(passLabel);

    gridbag.setConstraints(pass, c);
    pass.addActionListener(actionListener);
    pass.addKeyListener(keyListener);
    pane.add(pass);

    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.CENTER;
    JPanel panel = new JPanel();
    okButton.addActionListener(actionListener);
    okButton.addKeyListener(keyListener);
    panel.add(okButton);
    cancelButton.addActionListener(actionListener);
    cancelButton.addKeyListener(keyListener);
    panel.add(cancelButton);
    gridbag.setConstraints(panel, c);
    pane.add(panel);

    getContentPane().add(pane);

    pack();
  }