Example #1
0
  /** Konstruktor */
  public HelpWindow(String url) {
    super("dŽáma – nápověda");

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      System.err.println("Error setting native LAF: " + e);
    }
    this.setIconImage(new ImageIcon(getClass().getResource("/resources/icon_help.png")).getImage());
    String ourl = "";
    if (url.equals("jar")) {
      ourl = getClass().getResource("/resources/help/index.html").toString();
    } else {
      ourl = url;
    }
    try {
      htmlPane = new JEditorPane(ourl);
      htmlPane.setEditable(false);
      htmlPane.addHyperlinkListener(this);
      this.add(new JScrollPane(htmlPane));
    } catch (IOException ioe) {
      JOptionPane.showMessageDialog(
          this, "Soubor s nápovědou neexistuje", "D'oh!", JOptionPane.ERROR_MESSAGE);
    }

    this.setPreferredSize(new Dimension(600, 600));
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.pack();
    this.setLocationRelativeTo(null);
    this.setVisible(true);
    this.repaint();
  }
Example #2
0
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
     e.printStackTrace();
   }
   new IdeMain();
 }
 protected void installDefaults(JFileChooser fc) {
   installIcons(fc);
   installStrings(fc);
   usesSingleFilePane = UIManager.getBoolean("FileChooser.usesSingleFilePane");
   readOnly = UIManager.getBoolean("FileChooser.readOnly");
   TransferHandler th = fc.getTransferHandler();
   if (th == null || th instanceof UIResource) {
     fc.setTransferHandler(defaultTransferHandler);
   }
   LookAndFeel.installProperty(fc, "opaque", Boolean.FALSE);
 }
 private static void changeUI(boolean system) {
   try {
     // Set System L&F
     //      UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
     UIManager.setLookAndFeel(
         system
             ? UIManager.getSystemLookAndFeelClassName()
             : UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Example #5
0
  /** Creates a new view. */
  public NetView() {
    initComponents();

    scrollPane.setLayout(new PlacardScrollPaneLayout());
    scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));

    setEditor(new DefaultDrawingEditor());
    undo = new UndoRedoManager();
    view.setDrawing(createDrawing());
    view.getDrawing().addUndoableEditListener(undo);
    initActions();
    undo.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            setHasUnsavedChanges(undo.hasSignificantEdits());
          }
        });

    ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels");

    JPanel placardPanel = new JPanel(new BorderLayout());
    javax.swing.AbstractButton pButton;
    pButton = ButtonFactory.createZoomButton(view);
    pButton.putClientProperty("Quaqua.Button.style", "placard");
    pButton.putClientProperty("Quaqua.Component.visualMargin", new Insets(0, 0, 0, 0));
    pButton.setFont(UIManager.getFont("SmallSystemFont"));
    placardPanel.add(pButton, BorderLayout.WEST);
    toggleGridButton = pButton = ButtonFactory.createToggleGridButton(view);
    pButton.putClientProperty("Quaqua.Button.style", "placard");
    pButton.putClientProperty("Quaqua.Component.visualMargin", new Insets(0, 0, 0, 0));
    pButton.setFont(UIManager.getFont("SmallSystemFont"));
    labels.configureToolBarButton(pButton, "view.toggleGrid.placard");
    placardPanel.add(pButton, BorderLayout.EAST);
    scrollPane.add(placardPanel, JScrollPane.LOWER_LEFT_CORNER);

    toggleGridButton.setSelected(preferences.getBoolean("view.gridVisible", false));
    view.setScaleFactor(preferences.getDouble("view.scaleFactor", 1d));

    view.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if ("scaleFactor".equals(name)) {
              preferences.putDouble("view.scaleFactor", (Double) evt.getNewValue());
              firePropertyChange("scaleFactor", evt.getOldValue(), evt.getNewValue());
            }
          }
        });
  }
 /** The run method sets up the GUI and calls methods to add its components. */
 public void run() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     // matches the operating system's look and feel
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
   }
   setupPanels();
   setupFrame();
   listener.setGUI(this); // sets the DungeonListener object's reference to this class
 }
Example #7
0
 // --------------------------------createAndShowGUI-----------------------------
 public static void createAndShowGUI() {
   Game thisGame = new Game();
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   JFrame.setDefaultLookAndFeelDecorated(true);
   thisGame.frame = new JFrame("Tactics");
   thisGame.oConn = new SocketManager();
   thisGame.scrBounds = thisGame.frame.getGraphicsConfiguration().getBounds();
   thisGame.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
   thisGame.frame.setDefaultLookAndFeelDecorated(true);
   thisGame.frame.addWindowListener(thisGame);
   thisGame.frame.setVisible(true);
 }
Example #8
0
 public static void createAndShowGUI() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   }
   JFrame frame = new JFrame("@title@");
   frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   frame.getContentPane().add(new MainPanel());
   frame.pack();
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }
Example #9
0
  static Color getRolloverColor() {
    if (rollColor == null) {
      rollColor = getColorAlfa(UIManager.getColor("Button.focus"), 40);
    }

    return rollColor;
  }
Example #10
0
  public static void main(String[] args) throws Exception {
    // JFrame.setDefaultLookAndFeelDecorated(true);
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    ThumbMaker tm = new ThumbMaker();
    tm.pack();

    // center window onscreen
    Dimension window = tm.getSize();
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    int w = (screen.width - window.width) / 2;
    int h = (screen.height - window.height) / 2;
    tm.setLocation(w, h);

    tm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    tm.setVisible(true);
  }
Example #11
0
  @SuppressWarnings("OverridableMethodCallInConstructor")
  Notepad() {
    super(true);

    // Trying to set Nimbus look and feel
    try {
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception ignored) {
    }

    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());

    // create the embedded JTextComponent
    editor = createEditor();
    // Add this as a listener for undoable edits.
    editor.getDocument().addUndoableEditListener(undoHandler);

    // install the command table
    commands = new HashMap<Object, Action>();
    Action[] actions = getActions();
    for (Action a : actions) {
      commands.put(a.getValue(Action.NAME), a);
    }

    JScrollPane scroller = new JScrollPane();
    JViewport port = scroller.getViewport();
    port.add(editor);

    String vpFlag = getProperty("ViewportBackingStore");
    if (vpFlag != null) {
      Boolean bs = Boolean.valueOf(vpFlag);
      port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE);
    }

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add("North", createToolbar());
    panel.add("Center", scroller);
    add("Center", panel);
    add("South", createStatusbar());
  }
 /** Switch to a new Look&Feel */
 private void newLookAndFeel(String landf) {
   try {
     UIManager.setLookAndFeel(landf);
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception e) {
     System.err.println(e);
   }
 }
Example #13
0
 public static JMenu createLookAndFeelMenu() {
   JMenu menu = new JMenu("LookAndFeel");
   ButtonGroup lookAndFeelRadioGroup = new ButtonGroup();
   for (UIManager.LookAndFeelInfo lafInfo : UIManager.getInstalledLookAndFeels()) {
     menu.add(
         createLookAndFeelItem(lafInfo.getName(), lafInfo.getClassName(), lookAndFeelRadioGroup));
   }
   return menu;
 }
Example #14
0
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
      // UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
      // UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception ex) {
      System.err.println(ex);
    }

    JFrame frame = new JFrame("E+ idf TextPanel test");
    frame.getContentPane().add(new EPlusEditorPanel());
    // frame.getContentPane().add(new EPlusTextPanel (null, null, 1, null, null, null));
    frame.setSize(800, 800);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
Example #15
0
  /** p:初始化look and feel, 把一切放到这个里面.可以让多个地方调用. */
  public static void initLookAndFeel() {
    // p:隐藏对话框的系统标题风格,用look and feel定义的标题风格.
    try {
      UIManager.setLookAndFeel(UILookAndFeel.class.getName());
    } catch (Exception e) {
      FRLogger.getLogger().log(Level.WARNING, "Substance Raven Graphite failed to initialize");
    }
    // 获取当前系统语言下设计器用的默认字体
    FRFont guiFRFont = getCurrentLocaleFont();
    // 指定UIManager中字体
    Enumeration keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
      String key = keys.nextElement().toString();

      if (key.endsWith(".font")) {
        UIManager.put(key, isTextField(key) ? getNamedFont("Dialog") : guiFRFont);
      }
    }
  }
Example #16
0
  public static void main(String[] args) {

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, "Fatal Error Occurred!");
      System.exit(1);
    }

    /*View.SplashWindow s = new View.SplashWindow();

    s.setVisible(true);*/

    String fPath = args.length == 0 ? JOptionPane.showInputDialog("Enter source path") : args[0];
    File f = new File(fPath);
    if (!f.exists()) {
      System.out.println("Path does not exist!");
      System.exit(1);
    }

    String fDrive = fPath.substring(0, 3);
    File dFile = new File(fDrive);

    File[] dirs = Drive.getAllDrives();
    ArrayList<Drive> drives = new ArrayList<Drive>();

    for (int i = 0; i < dirs.length; i++) {

      if (!dirs[i].getPath().equals(dFile.getPath())) {
        System.out.println("Loading Drive " + dirs[i].getPath() + "...");
        drives.add(new Drive(dirs[i]));
      }
    }
    System.out.println("Done! Loading Interface...");
    // s.setVisible(false);

    Drive[] dr = new Drive[drives.size()];

    for (int i = 0; i < dr.length; i++) {
      dr[i] = drives.get(i);
    }
    new View(dr, f);
  }
 /**
  * Constructs and initializes this object
  *
  * @param viewerPanel the <code>JImageViewerPanel</code> this action is linked to
  * @param imageType
  */
 public ImageViewerPanelSaveAction(JImageViewerPanel viewerPanel, int imageType) {
   super(messagesBundle.getString("ImageViewerPanelSaveAction.Save_1")); // $NON-NLS-1$
   assert viewerPanel != null;
   this.imageType = imageType;
   this.viewerPanel = viewerPanel;
   putValue(
       SHORT_DESCRIPTION,
       messagesBundle.getString("ImageViewerPanelSaveAction.Save_image_to_file_2"));
   //$NON-NLS-1$
   putValue(SMALL_ICON, UIManager.getIcon("FileView.floppyDriveIcon")); // $NON-NLS-1$
 }
  public HelpFrame(String helpFileName) {
    super("Help", true, true, true, true);

    setFrameIcon(
        (Icon)
            UIManager.get(
                "Tree.openIcon")); // PENDING(steve) need more general palce to get this icon
    setBounds(200, 25, 400, 400);
    HtmlPane html = new HtmlPane(helpFileName);
    setContentPane(html);
  }
Example #19
0
 private static void setLookAndFeel(String lookAndFeel)
     throws ClassNotFoundException, InstantiationException, IllegalAccessException,
         UnsupportedLookAndFeelException {
   String oldLookAndFeel = LookAndFeelUtil.lookAndFeel;
   if (!oldLookAndFeel.equals(lookAndFeel)) {
     UIManager.setLookAndFeel(lookAndFeel);
     LookAndFeelUtil.lookAndFeel = lookAndFeel;
     updateLookAndFeel();
     // firePropertyChange("lookAndFeel", oldLookAndFeel, lookAndFeel);
   }
 }
Example #20
0
 /** @param args the command line arguments */
 public static void main(String args[]) {
   System.setProperty("entityExpansionLimit", "1000000");
   try (InputStream is = JmdictToDsl.class.getResourceAsStream("/logging.properties")) {
     LogManager.getLogManager().readConfiguration(is);
   } catch (IOException | SecurityException ex) {
     logger.log(Level.SEVERE, null, ex);
     System.exit(1);
   }
   SwingUtilities.invokeLater(
       () -> {
         try {
           UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
           new JmdictToDsl();
         } catch (ClassNotFoundException
             | InstantiationException
             | IllegalAccessException
             | UnsupportedLookAndFeelException ex) {
           logger.log(Level.SEVERE, null, ex);
         }
       });
 }
Example #21
0
    public void actionPerformed(JTextComponent text) {
      indentationLogic = ((EditorPane) text).getIndentationLogic();
      StyledDocument doc = (StyledDocument) text.getDocument();
      Element map = doc.getDefaultRootElement();
      Caret c = text.getCaret();
      int dot = c.getDot();
      int mark = c.getMark();
      int line1 = map.getElementIndex(dot);

      if (dot != mark) {
        int line2 = map.getElementIndex(mark);
        int begin = Math.min(line1, line2);
        int end = Math.max(line1, line2);
        Element elem;
        try {
          for (line1 = begin; line1 < end; line1++) {
            elem = map.getElement(line1);
            handleDecreaseIndent(line1, elem, doc);
          }
          elem = map.getElement(end);
          int start = elem.getStartOffset();
          if (Math.max(c.getDot(), c.getMark()) != start) {
            handleDecreaseIndent(end, elem, doc);
          }
        } catch (BadLocationException ble) {
          Debug.error(me + "Problem while de-indenting line\n%s", ble.getMessage());
          UIManager.getLookAndFeel().provideErrorFeedback(text);
        }
      } else {
        Element elem = map.getElement(line1);
        try {
          handleDecreaseIndent(line1, elem, doc);
        } catch (BadLocationException ble) {
          Debug.error(me + "Problem while de-indenting line\n%s", ble.getMessage());
          UIManager.getLookAndFeel().provideErrorFeedback(text);
        }
      }
    }
 /** Applet initialization */
 public void init() {
   // Get the port to be used
   String port_str = getParameter("port");
   if (port_str != null) {
     port = Integer.parseInt(port_str);
   }
   // Try to use the system look and feel
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   // Create main panel to hold notebook
   main_panel = new JPanel();
   main_panel.setBackground(Color.white);
   main_panel.setLayout(new BorderLayout());
   setContentPane(main_panel);
   // Create the notebook
   tabbed_pane = new JTabbedPane(JTabbedPane.TOP);
   main_panel.add(tabbed_pane, BorderLayout.CENTER);
   // Add notebook page for default host connection
   pages = new Vector();
   addPage(new SOAPMonitorPage(getCodeBase().getHost()));
 }
Example #23
0
  public UpdateAssetGUI() {
    try {
      PluginMgrClient.init();
      mclient = new MasterMgrClient();
      queue = new QueueMgrClient();
      plug = PluginMgrClient.getInstance();
      log = LogMgr.getInstance();

      pAssetManager = new TreeMap<String, AssetInfo>();

      project = "lr";
      charList = new TreeMap<String, String>();
      setsList = new TreeMap<String, String>();
      propsList = new TreeMap<String, String>();

      potentialUpdates = new TreeSet<String>();
      pSubstituteFields = new TreeMap<String, LinkedList<JBooleanField>>();

      /* load the look-and-feel */
      {
        try {
          SynthLookAndFeel synth = new SynthLookAndFeel();
          synth.load(
              LookAndFeelLoader.class.getResourceAsStream("synth.xml"), LookAndFeelLoader.class);
          UIManager.setLookAndFeel(synth);
        } catch (java.text.ParseException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to parse the look-and-feel XML file (synth.xml):\n" + "  " + ex.getMessage());
          System.exit(1);
        } catch (UnsupportedLookAndFeelException ex) {
          log.log(
              LogMgr.Kind.Ops,
              LogMgr.Level.Severe,
              "Unable to load the Pipeline look-and-feel:\n" + "  " + ex.getMessage());
          System.exit(1);
        }
      }

      /* application wide UI settings */
      {
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
        ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
      }
    } catch (PipelineException ex) {
      ex.printStackTrace();
    } // end try/catch
  } // end constructor
  public static void createAndShowGUI() {
    // Make sure we have nice window decorations.
    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception e) {
      JFrame.setDefaultLookAndFeelDecorated(true);
    }

    // JFrame.setDefaultLookAndFeelDecorated(true);
    // Create and set up the window.
    DnDTestWindow frame = new DnDTestWindow();

    // Display the window.
    frame.setVisible(true);
  }
 public MetalworksFrame() {
   super("Metalworks");
   final int inset = 50;
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset * 2);
   buildContent();
   buildMenus();
   this.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           quit();
         }
       });
   UIManager.addPropertyChangeListener(new UISwitchListener((JComponent) getRootPane()));
 }
Example #26
0
  public static void createAndShowGUI() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
    }
    // UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.allAuditoryCues"));
    // UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.defaultCueList"));
    // UIManager.put("AuditoryCues.playList", UIManager.get("AuditoryCues.noAuditoryCues"));
    UIManager.put("AuditoryCues.playList", OPTION_PANE_AUDITORY_CUES);
    // UIManager.put("OptionPane.informationSound", "/example/notice2.wav");
    // UIManager.put("OptionPane.informationSound", "sounds/OptionPaneError.wav");
    // System.out.println(UIManager.get("AuditoryCues.actionMap"));

    JFrame frame = new JFrame("@title@");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.getContentPane().add(new MainPanel());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
  /** Create a menu which allows the user to select a different look and feel at runtime. */
  public JMenu createLookAndFeelMenu() {
    CommandMenu menu = new CommandMenu("Look'n'Feel");

    UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();

    for (int i = 0; i < lafs.length; i++) {
      final String lnfClassName = lafs[i].getClassName();
      Command cmd =
          new AbstractCommand(lafs[i].getName(), this) {
            public void execute() {
              newLookAndFeel(lnfClassName);
            }
          };
      menu.add(cmd);
    }
    return menu;
  }
Example #28
0
 protected void fileOpened(final Project project, File file, Object value) {
   if (value == null) {
     project.setFile(file);
     project.setEnabled(true);
     getApplication().addRecentFile(file);
   } else {
     JSheet.showMessageSheet(
         project.getComponent(),
         "<html>"
             + UIManager.getString("OptionPane.css")
             + "<b>Couldn't open the file \""
             + file
             + "\".</b><br>"
             + value,
         JOptionPane.ERROR_MESSAGE,
         new SheetListener() {
           public void optionSelected(SheetEvent evt) {
             project.clear();
             project.setEnabled(true);
           }
         });
   }
 }
Example #29
0
  @Override
  public void paintIcon(Component c, Graphics g, int x, int y) {
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.translate(x, y);

    g2.setStroke(new BasicStroke(BORDER_WIDTH));
    g2.setPaint(LINE_COLOR);
    g2.draw(BORDER);

    g2.setStroke(new BasicStroke(SLIT_WIDTH));
    g2.setColor(UIManager.getColor("Panel.background"));

    int n = SLIT_NUM + 1;
    int v = ICON_SIZE / n;
    int m = n * v;
    for (int i = 1; i < n; i++) {
      int a = i * v;
      g2.drawLine(a, 0, a, m);
      g2.drawLine(0, a, m, a);
    }

    // g2.drawLine(1 * v, 0 * v, 1 * v, 4 * v);
    // g2.drawLine(2 * v, 0 * v, 2 * v, 4 * v);
    // g2.drawLine(3 * v, 0 * v, 3 * v, 4 * v);
    // g2.drawLine(0 * v, 1 * v, 4 * v, 1 * v);
    // g2.drawLine(0 * v, 2 * v, 4 * v, 2 * v);
    // g2.drawLine(0 * v, 3 * v, 4 * v, 3 * v);

    g2.setPaint(LINE_COLOR);
    Rectangle2D b = ARROW.getBounds();
    Point2D p = new Point2D.Double(b.getX() + b.getWidth() / 2d, b.getY() + b.getHeight() / 2d);
    AffineTransform toCenterAT =
        AffineTransform.getTranslateInstance(ICON_SIZE / 2d - p.getX(), ICON_SIZE / 2d - p.getY());
    g2.fill(toCenterAT.createTransformedShape(ARROW));
    g2.dispose();
  }
Example #30
0
    public void actionPerformed(JTextComponent text) {
      indentationLogic = ((EditorPane) text).getIndentationLogic();
      boolean indentError = false;
      Document doc = text.getDocument();
      Element map = doc.getDefaultRootElement();
      String tabWhitespace = PreferencesUser.getInstance().getTabWhitespace();
      Caret c = text.getCaret();
      int dot = c.getDot();
      int mark = c.getMark();
      int dotLine = map.getElementIndex(dot);
      int markLine = map.getElementIndex(mark);

      if (dotLine != markLine) {
        int first = Math.min(dotLine, markLine);
        int last = Math.max(dotLine, markLine);
        Element elem;
        int start;
        try {
          for (int i = first; i < last; i++) {
            elem = map.getElement(i);
            start = elem.getStartOffset();
            doc.insertString(start, tabWhitespace, null);
          }
          elem = map.getElement(last);
          start = elem.getStartOffset();
          if (Math.max(c.getDot(), c.getMark()) != start) {
            doc.insertString(start, tabWhitespace, null);
          }
        } catch (BadLocationException ble) {
          Debug.error(me + "Problem while indenting line\n%s", ble.getMessage());
          UIManager.getLookAndFeel().provideErrorFeedback(text);
        }
      } else {
        text.replaceSelection(tabWhitespace);
      }
    }