Skip to content

Commit

Permalink
Dynamic menu example improvement
Browse files Browse the repository at this point in the history
RSyntaxTextArea library update
  • Loading branch information
mgarin committed Jun 30, 2014
1 parent e8b4fda commit 645bf9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Binary file modified lib/rsyntaxtextarea.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import com.alee.extended.menu.DynamicMenuType;
import com.alee.extended.menu.WebDynamicMenu;
import com.alee.extended.menu.WebDynamicMenuItem;
import com.alee.extended.panel.AlignPanel;
import com.alee.extended.panel.GroupPanel;
import com.alee.extended.panel.GroupingType;
import com.alee.laf.checkbox.WebCheckBox;
import com.alee.laf.combobox.WebComboBox;
import com.alee.laf.label.WebLabel;
import com.alee.laf.panel.WebPanel;
Expand Down Expand Up @@ -55,6 +57,7 @@ public class DynamicMenuExample extends DefaultExample
private WebComboBox hidingType;
private WebTextField radius;
private WebTextField itemsAmount;
private WebCheckBox drawBorder;

/**
* {@inheritDoc}
Expand Down Expand Up @@ -101,6 +104,8 @@ public Component getPreview ( final WebLookAndFeelDemo owner )
itemsAmount = new WebTextField ( new IntTextDocument (), "5", 4 );
final GroupPanel iag = new GroupPanel ( 5, new WebLabel ( "Items amount:" ), itemsAmount );

drawBorder = new WebCheckBox ( "Show custom border", true );

final WebPanel clickPanel = new WebPanel ( true );
clickPanel.add ( new WebLabel ( "Click with left mouse button here to show menu", WebLabel.CENTER ) );
clickPanel.addMouseListener ( new MouseAdapter ()
Expand All @@ -115,8 +120,9 @@ public void mousePressed ( final MouseEvent e )
}
} );

final GroupPanel controls = new GroupPanel ( 15, tg, htg, rg, iag );
return new GroupPanel ( GroupingType.fillLast, 10, false, controls, clickPanel ).setMargin ( 10 );
final GroupPanel controls = new GroupPanel ( 15, tg, htg, rg, iag, drawBorder );
final AlignPanel alignPanel = new AlignPanel ( controls, SwingConstants.CENTER, SwingConstants.CENTER );
return new GroupPanel ( GroupingType.fillLast, 10, false, alignPanel, clickPanel ).setMargin ( 10 );
}

/**
Expand Down Expand Up @@ -147,6 +153,7 @@ public void actionPerformed ( final ActionEvent e )
}
} );
item.setMargin ( new Insets ( 8, 8, 8, 8 ) );
item.setDrawBorder ( drawBorder.isSelected () );
menu.addItem ( item );
}

Expand Down

0 comments on commit 645bf9a

Please sign in to comment.