com.alee.extended.panel.GroupPanel Java Examples

The following examples show how to use com.alee.extended.panel.GroupPanel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationDialog.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
PrivacyPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Privacy Settings")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    mSubscriptionBox = createCheckBox(Tr.tr("Automatically grant authorization"),
             Tr.tr("Automatically grant online status authorization requests from other users"),
            mConf.getBoolean(Config.NET_AUTO_SUBSCRIPTION));
    groupPanel.add(new GroupPanel(mSubscriptionBox, new WebSeparator()));

    mChatStateBox = createCheckBox(Tr.tr("Send chatstate notification"),
            Tr.tr("Send chat activity (typing,…) to other users"),
            mConf.getBoolean(Config.NET_SEND_CHAT_STATE));
    groupPanel.add(new GroupPanel(mChatStateBox, new WebSeparator()));

    mRosterNameBox = createCheckBox(Tr.tr("Upload contact names"),
            Tr.tr("Upload your contact names to the server for client synchronization"),
            mConf.getBoolean(Config.NET_SEND_ROSTER_NAME));
    groupPanel.add(new GroupPanel(mRosterNameBox, new WebSeparator()));

    this.add(groupPanel);
}
 
Example #2
Source File: ImportDialog.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
IntroPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Get Started")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    // html tag for word wrap
    String text = "<html>"+
            Tr.tr("Welcome to the import wizard.")+" "
            +Tr.tr("To use the Kontalk desktop client you need an existing account.")+" "
            +Tr.tr("Please export the personal key files from your Android device and select them on the next page.")
            +"</html>";
    groupPanel.add(new WebLabel(text));

    this.add(groupPanel);
}
 
Example #3
Source File: WebNotificationExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" );
    button.addActionListener ( new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            final WebLabel title = new WebLabel ( getPreviewLanguagePrefix () + "text", WebLabel.CENTER );
            final WebImage logo = new WebImage ( WebLookAndFeel.getIcon ( 256 ) );
            final GroupPanel content = new GroupPanel ( 15, false, title, logo );
            NotificationManager.showNotification ( button, content, ( Icon ) null );
        }
    } );
    return CollectionUtils.asList ( button );
}
 
Example #4
Source File: ContactListView.java    From desktopclient-java with GNU General Public License v3.0 6 votes vote down vote up
FlyweightContactItem() {
    //this.setPaintFocus(true);
    this.setLayout(new BorderLayout(View.GAP_DEFAULT, 0));
    this.setMargin(View.MARGIN_SMALL);

    mAvatar = new ComponentUtils.AvatarImage(View.AVATAR_LIST_SIZE);
    this.add(mAvatar, BorderLayout.WEST);

    mNameLabel = new WebLabel();
    mNameLabel.setFontSize(View.FONT_SIZE_BIG);
    mNameLabel.setDrawShade(true);

    mStatusLabel = new WebLabel();
    mStatusLabel.setForeground(Color.GRAY);
    mStatusLabel.setFontSize(View.FONT_SIZE_TINY);
    this.add(
            new GroupPanel(View.GAP_SMALL, false,
                    mNameLabel,
                    new GroupPanel(GroupingType.fillFirst,
                            Box.createGlue(), mStatusLabel)
            ), BorderLayout.CENTER);
}
 
Example #5
Source File: AboutLibraryDialog.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns operation system version panel.
 *
 * @return operation system version panel
 */
@NotNull
private WebPanel createOsVersionPanel ()
{
    final WebImage osIcon = new WebImage ( SystemUtils.getOsIcon ( 32, false ) );

    final WebLink version = new WebLink ( SystemUtils.getOsName (), new UrlLinkAction ( SystemUtils.getOsSite () ) );
    version.setBoldFont ();

    final WebLabel osVersion = new WebLabel ();
    osVersion.setLanguage ( "weblaf.about.dialog.general.os.arch", SystemUtils.getOsArch () );

    return new GroupPanel ( StyleId.panelTransparent, 15, osIcon, new GroupPanel ( false, version, osVersion ) );
}
 
Example #6
Source File: WebLaF.java    From Cafebabe with GNU General Public License v3.0 5 votes vote down vote up
public static GroupPanel createInfoLabel(JLabel nameLabel, String overlayText) {
	WebOverlay overlayPanel = new WebOverlay();
	overlayPanel.setComponent(nameLabel);
	WebImage overlay = new WebImage(info);
	TooltipManager.setTooltip(overlay, overlayText, TooltipWay.trailing, 0);
	overlayPanel.addOverlay(overlay, SwingConstants.TRAILING, SwingConstants.TOP);
	overlayPanel.setComponentMargin(0, 0, 0, overlay.getPreferredSize().width);
	return new GroupPanel(overlayPanel);
}
 
Example #7
Source File: AboutLibraryDialog.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns java version panel.
 *
 * @return java version panel
 */
@NotNull
private WebPanel createJavaVersionPanel ()
{
    final WebImage javaIcon = new WebImage ( new LazyIcon ( "java32" ) );

    final WebLink javaVersion = new WebLink ();
    javaVersion.setLanguage ( "weblaf.about.dialog.general.java.version", SystemUtils.getJavaVersionString () );
    javaVersion.addAction ( new UrlLinkAction ( "http://www.oracle.com/technetwork/java/javase/overview/" ) );
    javaVersion.setBoldFont ();

    final WebLabel javaName = new WebLabel ( SystemUtils.getJavaName () );

    return new GroupPanel ( StyleId.panelTransparent, 15, javaIcon, new GroupPanel ( false, javaVersion, javaName ) );
}
 
Example #8
Source File: AboutLibraryDialog.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns library version panel.
 *
 * @return library version panel
 */
@NotNull
private WebPanel createLibraryVersionPanel ()
{
    final Version version = new Version ( AboutLibraryDialog.class );

    final WebImage icon = new WebImage ( WebLookAndFeel.getIcon ( 32 ) );

    final WebLink versionNumber = new WebLink ( version.toString (), new UrlLinkAction ( "https://github.com/mgarin/weblaf" ) );
    versionNumber.setBoldFont ();

    final WebLabel versionName = new WebLabel ( version.name () );

    return new GroupPanel ( StyleId.panelTransparent, 15, icon, new GroupPanel ( false, versionNumber, versionName ) );
}
 
Example #9
Source File: ExamplesFrame.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructs examples frame.
 */
public ExamplesFrame ()
{
    super ( StyleId.dockableframeCompact, ID, DemoIcons.examples16, "demo.examples.title" );
    setPosition ( CompassDirection.west );
    setPreferredSize ( 300, 200 );

    // Examples tree
    final ExamplesTree examplesTree = new ExamplesTree ();
    examplesTree.onKeyPress ( Hotkey.ENTER, new KeyEventRunnable ()
    {
        @Override
        public void run ( @NotNull final KeyEvent e )
        {
            open ( examplesTree.getSelectedNode () );
        }
    } );
    examplesTree.onNodeDoubleClick ( new TreeNodeEventRunnable<ExamplesTreeNode> ()
    {
        @Override
        public void run ( @NotNull final ExamplesTreeNode node )
        {
            open ( node );
        }
    } );
    examplesTree.registerSettings ( new Configuration<TreeState> ( "ExamplesTree" ) );
    final WebScrollPane examplesTreeScroll = new WebScrollPane ( StyleId.scrollpaneTransparentHoveringExtending, examplesTree );
    examplesTreeScroll.registerSettings ( new Configuration<ScrollPaneState> ( "ExamplesScroll" ) );

    // Filtering field
    final WebTreeFilterField filter = new WebTreeFilterField ( DemoStyles.filterfield, examplesTree );

    // Frame UI composition
    final WebSeparator separator = new WebSeparator ( StyleId.separatorHorizontal );
    add ( new GroupPanel ( GroupingType.fillLast, 0, false, filter, separator, examplesTreeScroll ) );
}
 
Example #10
Source File: SampleInterface.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns sample auth form UI.
 *
 * @return sample auth form UI
 */
@NotNull
public static JComponent createAuthForm ()
{
    final WebPanel form = new WebPanel ( StyleId.panelDecorated, new FormLayout ( 10, 10 ) );
    form.setPadding ( 15, 25, 15, 25 );

    form.add ( new WebStyledLabel ( "demo.sample.interface.auth.title", SwingConstants.CENTER ), FormLayout.LINE );

    form.add ( new WebLabel ( "demo.sample.interface.auth.login", SwingConstants.RIGHT ) );
    form.add ( new WebTextField ( 15 ) );

    form.add ( new WebLabel ( "demo.sample.interface.auth.password", SwingConstants.RIGHT ) );
    form.add ( new WebPasswordField ( 15 ) );

    form.add ( new AlignPanel (
            new GroupPanel (
                    5, true,
                    new WebButton ( "demo.sample.interface.auth.buttons.login" ).setPreferredWidth ( 100 ),
                    new WebButton ( "demo.sample.interface.auth.buttons.cancel" ).setPreferredWidth ( 100 )
            ),
            AlignPanel.CENTER,
            AlignPanel.CENTER
    ), FormLayout.LINE );

    return form;
}
 
Example #11
Source File: WebTreeFilterFieldExample.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final ExTreeDataProvider<SampleNode> dataProvider = SampleData.createExTreeDataProvider ();
    final WebExCheckBoxTree tree = new WebExCheckBoxTree ( getStyleId (), dataProvider, new SampleTreeCellEditor () );
    tree.setVisibleRowCount ( 8 );

    final WebScrollPane treeScroll = new WebScrollPane ( tree );
    treeScroll.setPreferredWidth ( 200 );

    final WebTreeFilterField filterField = new WebTreeFilterField ( tree );

    return CollectionUtils.asList ( new GroupPanel ( 8, false, filterField, treeScroll ) );
}
 
Example #12
Source File: WebTreeFilterFieldExample.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final AsyncTreeDataProvider<SampleNode> dataProvider = SampleData.createDelayingAsyncDataProvider ();
    final WebAsyncTree tree = new WebAsyncTree ( getStyleId (), dataProvider, new SampleTreeCellEditor () );
    tree.setVisibleRowCount ( 8 );

    final WebScrollPane treeScroll = new WebScrollPane ( tree );
    treeScroll.setPreferredWidth ( 200 );

    final WebTreeFilterField filterField = new WebTreeFilterField ( tree );

    return CollectionUtils.asList ( new GroupPanel ( 8, false, filterField, treeScroll ) );
}
 
Example #13
Source File: WebTreeFilterFieldExample.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final ExTreeDataProvider<SampleNode> dataProvider = SampleData.createExTreeDataProvider ();
    final WebExTree tree = new WebExTree ( getStyleId (), dataProvider, new SampleTreeCellEditor () );
    tree.setVisibleRowCount ( 8 );

    final WebScrollPane treeScroll = new WebScrollPane ( tree );
    treeScroll.setPreferredWidth ( 200 );

    final WebTreeFilterField filterField = new WebTreeFilterField ( tree );

    return CollectionUtils.asList ( new GroupPanel ( 8, false, filterField, treeScroll ) );
}
 
Example #14
Source File: ChatListView.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
FlyweightChatItem() {
    this.setLayout(new BorderLayout(View.GAP_DEFAULT, 0));
    this.setMargin(View.MARGIN_DEFAULT);

    mAvatar = new ComponentUtils.AvatarImage(View.AVATAR_LIST_SIZE);
    this.add(mAvatar, BorderLayout.WEST);

    mTitleLabel = new WebLabel();
    mTitleLabel.setFontSize(View.FONT_SIZE_BIG);
    mTitleLabel.setDrawShade(true);

    mStatusLabel = new WebLabel();
    mStatusLabel.setForeground(Color.GRAY);
    mStatusLabel.setFontSize(View.FONT_SIZE_TINY);
    this.add(mStatusLabel, BorderLayout.EAST);

    mChatStateLabel = new WebLabel();
    mChatStateLabel.setForeground(View.DARK_RED);
    mChatStateLabel.setFontSize(View.FONT_SIZE_TINY);
    mChatStateLabel.setBoldFont();
    //mChatStateLabel.setMargin(0, 5, 0, 5);

    this.add(
            new GroupPanel(View.GAP_SMALL, false,
                    mTitleLabel,
                    new GroupPanel(GroupingType.fillFirst,
                            Box.createGlue(), mStatusLabel, mChatStateLabel)
            ), BorderLayout.CENTER);
}
 
Example #15
Source File: ImportDialog.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
ResultPanel() {
    mImporter = mView.getControl().createAccountImporter();
    mImporter.addObserver(this);

    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Import results")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    mResultLabel = new WebLabel();
    groupPanel.add(mResultLabel);
    mErrorLabel = new WebLabel();
    groupPanel.add(mErrorLabel);

    mPassPanel = new ComponentUtils.PassPanel(false) {
        @Override
        void onValidInput() {
            mFinishButton.setEnabled(true);
        }
        @Override
        void onInvalidInput() {
            mFinishButton.setEnabled(false);
        }
    };
    groupPanel.add(mPassPanel);

    this.add(groupPanel);
}
 
Example #16
Source File: ConfigurationDialog.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
MainPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Main Settings")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    mTrayBox = createCheckBox(Tr.tr("Show tray icon"),
            "",
            mConf.getBoolean(Config.MAIN_TRAY));
    mTrayBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            mCloseTrayBox.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mCloseTrayBox = createCheckBox(Tr.tr("Close to tray"),
            "",
            mConf.getBoolean(Config.MAIN_TRAY_CLOSE));
    mCloseTrayBox.setEnabled(mTrayBox.isSelected());
    groupPanel.add(new GroupPanel(View.GAP_DEFAULT, mTrayBox, mCloseTrayBox));

    mEnterSendsBox = createCheckBox(Tr.tr("Enter key sends"),
            Tr.tr("Enter key sends text, Control+Enter adds new line - or vice versa"),
            mConf.getBoolean(Config.MAIN_ENTER_SENDS));
    groupPanel.add(new GroupPanel(mEnterSendsBox, new WebSeparator()));

    mShowUserBox = createCheckBox(Tr.tr("Display yourself in contacts"),
            Tr.tr("Display yourself in the contact list"),
            mConf.getBoolean(Config.VIEW_USER_CONTACT));
    groupPanel.add(new GroupPanel(mShowUserBox, new WebSeparator()));

    mHideBlockedBox = createCheckBox(Tr.tr("Hide blocked contacts"),
            Tr.tr("Hide blocked contacts in the contact list"),
            mConf.getBoolean(Config.VIEW_HIDE_BLOCKED));
    groupPanel.add(new GroupPanel(mHideBlockedBox, new WebSeparator()));

    this.add(groupPanel);
}
 
Example #17
Source File: ComponentUtils.java    From desktopclient-java with GNU General Public License v3.0 5 votes vote down vote up
CellRenderer() {
    mNameLabel = new WebLabel();
    mRoleLabel = new WebLabel();
    mRoleLabel.setForeground(View.DARK_GREEN);

    this.setMargin(View.MARGIN_DEFAULT);
    this.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));

    this.add(new GroupPanel(GroupingType.fillMiddle, View.GAP_DEFAULT,
            mNameLabel, Box.createGlue(), mRoleLabel),
            BorderLayout.CENTER);
}
 
Example #18
Source File: DynamicMenu.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public DynamicMenu () {
    super ();

    // Custom display event
    getContentPane ().addMouseListener ( new MouseAdapter ()
    {
        @Override
        public void mousePressed ( final MouseEvent e )
        {
            if ( SwingUtils.isMiddleMouseButton ( e ) )
            {
                // Menu with custom elements
                createMenu ().showMenu ( e.getComponent (), e.getPoint () );
            }
        }
    } );

    setLayout ( new FlowLayout ( FlowLayout.CENTER, 15, 15 ) );

    type = new WebComboBox ( DynamicMenuType.values (), DynamicMenuType.shutter );
    add ( new GroupPanel ( 5, new WebLabel ( "Display animation:" ), type ) );

    hidingType = new WebComboBox ( DynamicMenuType.values (), DynamicMenuType.shutter );
    add ( new GroupPanel ( 5, new WebLabel ( "Hide animation:" ), hidingType ) );

    radius = new WebTextField ( new IntTextDocument (), "70", 4 );
    add ( new GroupPanel ( 5, new WebLabel ( "Menu radius:" ), radius ) );

    amount = new WebTextField ( new IntTextDocument (), "5", 4 );
    add ( new GroupPanel ( 5, new WebLabel ( "Items amount:" ), amount ) );

    setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE );
    setSize ( 800, 600 );
    setLocationRelativeTo ( null );
    setVisible ( true );
}
 
Example #19
Source File: ConfigurationDialog.java    From desktopclient-java with GNU General Public License v3.0 4 votes vote down vote up
ViewPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("View Settings")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    String bgPath = mConf.getString(Config.VIEW_CHAT_BG);
    mBGBox = createCheckBox(Tr.tr("Custom background:")+" ",
            "",
            !bgPath.isEmpty());
    mBGBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            mBGChooser.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mBGChooser.getChooseButton().setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    TooltipManager.addTooltip(mBGBox, Tr.tr("Background image for all chats"));
    mBGChooser = Utils.createImageChooser(bgPath);
    mBGChooser.setEnabled(mBGBox.isSelected());
    groupPanel.add(new GroupPanel(GroupingType.fillLast, mBGBox, mBGChooser));

    mMessageFontSizeMap = new LinkedHashMap<>();
    mMessageFontSizeMap.put(Tr.tr("Small"), 1);
    mMessageFontSizeMap.put(Tr.tr("Normal"), -1);
    mMessageFontSizeMap.put(Tr.tr("Large"), 2);
    mMessageFontSizeMap.put(Tr.tr("Huge"), 3);

    mMessageFontSizeBox = new WebComboBox(new ArrayList<>(mMessageFontSizeMap.keySet()).toArray());
    int fontSizeIndex = new ArrayList<>(mMessageFontSizeMap.values()).indexOf(
            mConf.getInt(Config.VIEW_MESSAGE_FONT_SIZE));
    if (fontSizeIndex >= 0)
        mMessageFontSizeBox.setSelectedIndex(fontSizeIndex);
    TooltipManager.addTooltip(mMessageFontSizeBox, Tr.tr("Font size for message text and date"));

    groupPanel.add(new GroupPanel(View.GAP_DEFAULT,
            new WebLabel(Tr.tr("Font size for chat messages:")),
            mMessageFontSizeBox,
            new WebSeparator()));

    this.add(groupPanel);
}
 
Example #20
Source File: ConfigurationDialog.java    From desktopclient-java with GNU General Public License v3.0 4 votes vote down vote up
NetworkPanel() {
    GroupPanel groupPanel = new GroupPanel(View.GAP_DEFAULT, false);
    groupPanel.setMargin(View.MARGIN_BIG);

    groupPanel.add(new WebLabel(Tr.tr("Network Settings")).setBoldFont());
    groupPanel.add(new WebSeparator(true, true));

    mConnectStartupBox = createCheckBox(Tr.tr("Connect on startup"),
            "",
            mConf.getBoolean(Config.MAIN_CONNECT_STARTUP));
    groupPanel.add(mConnectStartupBox);

    mConnectRetryBox = createCheckBox(Tr.tr("Retry on connection failure"),
            Tr.tr("Try automatic (re-)connect after connection failure"),
            mConf.getBoolean(Config.NET_RETRY_CONNECT));
    groupPanel.add(new GroupPanel(mConnectRetryBox, new WebSeparator()));

    mRequestAvatars = createCheckBox(Tr.tr("Download profile pictures"),
            Tr.tr("Download the profile pictures of your contacts"),
            mConf.getBoolean(Config.NET_REQUEST_AVATARS));
    groupPanel.add(new GroupPanel(mRequestAvatars, new WebSeparator()));

    mImgResizeMap = new LinkedHashMap<>();
    mImgResizeMap.put(-1, Tr.tr("Original"));
    mImgResizeMap.put(300 * 1000, Tr.tr("Small (0.3MP)"));
    mImgResizeMap.put(500 * 1000, Tr.tr("Medium (0.5MP)"));
    mImgResizeMap.put(800 * 1000, Tr.tr("Large (0.8MP)"));

    mMaxImgSizeBox = new WebComboBox(new ArrayList<>(mImgResizeMap.values()).toArray());
    int maxImgIndex = new ArrayList<>(mImgResizeMap.keySet()).indexOf(
            mConf.getInt(Config.NET_MAX_IMG_SIZE));
    if (maxImgIndex >= 0)
        mMaxImgSizeBox.setSelectedIndex(maxImgIndex);
    TooltipManager.addTooltip(mMaxImgSizeBox, Tr.tr("Reduce size of images before sending"));

    groupPanel.add(new GroupPanel(View.GAP_DEFAULT,
            new WebLabel(Tr.tr("Resize image attachments:")),
            mMaxImgSizeBox,
            new WebSeparator()));

    this.add(groupPanel);
}
 
Example #21
Source File: InterfaceInspector.java    From weblaf with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructs new {@link InterfaceInspector} for the specified {@link Component} and its childrens tree.
 *
 * @param id        {@link StyleId}
 * @param inspected {@link Component} to inspect
 */
public InterfaceInspector ( @NotNull final StyleId id, @Nullable final Component inspected )
{
    super ( id );

    // Tree scroll
    final WebScrollPane scrollPane = new WebScrollPane ( StyleId.inspectorScroll.at ( InterfaceInspector.this ) );
    scrollPane.setPreferredWidth ( 300 );

    // Interface tree
    tree = new InterfaceTree ( StyleId.inspectorTree.at ( scrollPane ), inspected );
    scrollPane.getViewport ().setView ( tree );

    // Filtering field
    final WebTreeFilterField filter = new WebTreeFilterField ( StyleId.inspectorFilter.at ( InterfaceInspector.this ), tree );

    // Component inspect behavior
    final WebToggleButton inspectToggle = new WebToggleButton ( StyleId.inspectorInspect.at ( filter ), Icons.target );
    inspectToggle.setRolloverIcon ( Icons.targetHover );
    inspectToggle.setSelectedIcon ( Icons.targetSelected );
    inspectToggle.setCursor ( Cursor.getDefaultCursor () );
    inspectToggle.addHotkey ( Hotkey.CTRL_I );
    inspectToggle.addActionListener ( new ActionListener ()
    {
        @Override
        public void actionPerformed ( @NotNull final ActionEvent e )
        {
            if ( inspectToggle.isSelected () )
            {
                if ( inspectBehavior == null )
                {
                    inspectBehavior = new ComponentInspectBehavior ();
                }
                if ( !inspectBehavior.isInstalled () )
                {
                    inspectBehavior.install ( inspected, new InspectionListener ()
                    {
                        @Override
                        public void inspected ( @NotNull final Component component )
                        {
                            tree.navigate ( component );
                            inspectToggle.setSelected ( false );
                            tree.requestFocusInWindow ();
                        }

                        @Override
                        public void cancelled ()
                        {
                            inspectToggle.setSelected ( false );
                        }
                    } );
                }
            }
            else
            {
                if ( inspectBehavior != null && inspectBehavior.isInstalled () )
                {
                    inspectBehavior.uninstall ();
                }
            }
        }
    } );
    filter.setTrailingComponent ( inspectToggle );

    // UI composition
    final WebSeparator separator = new WebSeparator ( StyleId.inspectorSeparator.at ( InterfaceInspector.this ) );
    add ( new GroupPanel ( GroupingType.fillLast, 0, false, filter, separator, scrollPane ) );

    // Expanding tree root by default
    tree.expandRoot ();

    // Visibility behavior
    new VisibilityBehavior<InterfaceInspector> ( this, true )
    {
        @Override
        protected void hidden ( @NotNull final InterfaceInspector inspector )
        {
            if ( inspectBehavior != null && inspectBehavior.isInstalled () )
            {
                inspectBehavior.uninstall ();
            }
        }
    }.install ();
}