Search in sources :

Example 1 with JToolTipI18n

use of com.jsql.view.swing.text.JToolTipI18n in project jsql-injection by ron190.

the class PanelConsoles method buildI18nTab.

private void buildI18nTab(String keyLabel, String keyTooltip, Icon icon, Component manager, int position) {
    final JToolTipI18n[] j = new JToolTipI18n[] { new JToolTipI18n(I18nView.valueByKey(keyTooltip)) };
    JLabel labelTab = new JLabel(I18nView.valueByKey(keyLabel), icon, SwingConstants.CENTER) {

        @Override
        public JToolTip createToolTip() {
            JToolTip tipI18n = new JToolTipI18n(I18nView.valueByKey(keyTooltip));
            j[0] = (JToolTipI18n) tipI18n;
            return tipI18n;
        }
    };
    labelTab.setName(keyLabel);
    labelTab.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            MediatorGui.tabConsoles().setSelectedComponent(manager);
            super.mousePressed(e);
        }
    });
    MediatorGui.tabConsoles().insertTab(I18nView.valueByKey(keyLabel), icon, manager, null, position);
    MediatorGui.tabConsoles().setTabComponentAt(MediatorGui.tabConsoles().indexOfTab(I18nView.valueByKey(keyLabel)), labelTab);
    I18nView.addComponentForKey(keyLabel, labelTab);
    I18nView.addComponentForKey(keyTooltip, j[0]);
    labelTab.setToolTipText(I18nView.valueByKey(keyTooltip));
}
Also used : JToolTip(javax.swing.JToolTip) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) JToolTipI18n(com.jsql.view.swing.text.JToolTipI18n)

Example 2 with JToolTipI18n

use of com.jsql.view.swing.text.JToolTipI18n in project jsql-injection by ron190.

the class TabManagers method buildI18nTab.

private void buildI18nTab(String keyLabel, String keyTooltip, Icon icon, Component manager) {
    final JToolTipI18n[] tooltip = new JToolTipI18n[] { new JToolTipI18n(I18n.valueByKey(keyTooltip)) };
    JLabel labelTab = new JLabel(I18n.valueByKey(keyLabel), icon, SwingConstants.CENTER) {

        @Override
        public JToolTip createToolTip() {
            JToolTip tipI18n = new JToolTipI18n(I18n.valueByKey(keyTooltip));
            tooltip[0] = (JToolTipI18n) tipI18n;
            return tipI18n;
        }
    };
    labelTab.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            TabManagers.this.setSelectedComponent(manager);
            super.mousePressed(e);
        }
    });
    this.addTab(I18n.valueByKey(keyLabel), icon, manager);
    this.setTabComponentAt(this.indexOfTab(I18n.valueByKey(keyLabel)), labelTab);
    I18nView.addComponentForKey(keyLabel, labelTab);
    I18nView.addComponentForKey(keyTooltip, tooltip[0]);
    labelTab.setToolTipText(I18n.valueByKey(keyTooltip));
    labelTab.addMouseListener(new TabSelectionMouseHandler());
}
Also used : JToolTip(javax.swing.JToolTip) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) JToolTipI18n(com.jsql.view.swing.text.JToolTipI18n)

Aggregations

JToolTipI18n (com.jsql.view.swing.text.JToolTipI18n)2 MouseAdapter (java.awt.event.MouseAdapter)2 MouseEvent (java.awt.event.MouseEvent)2 JLabel (javax.swing.JLabel)2 JToolTip (javax.swing.JToolTip)2