Java Code Examples for net.miginfocom.swing.MigLayout#setColumnConstraints()
The following examples show how to use
net.miginfocom.swing.MigLayout#setColumnConstraints() .
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: SidebarPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
SidebarPanel(IDeckConsumer aConsumer) { deckPicker = new DeckPicker(); deckPicker.addListener(aConsumer); deckInfo = new DeckInfoPanel(); deckInfo.addPropertyChangeListener( DeckInfoPanel.CP_LAYOUT_CHANGED, (e) -> refreshLayout() ); final int BORDER_WIDTH = 1; setBorder(BorderFactory.createMatteBorder(0, 0, 0, BORDER_WIDTH, Color.BLACK)); setBackground(FontsAndBorders.TRANSLUCENT_WHITE_STRONG); setMinimumSize(new Dimension(CardViewer.getSidebarImageSize().width + BORDER_WIDTH, 0)); MigLayout mig = new MigLayout("flowy, insets 0, gap 0"); mig.setColumnConstraints("[fill, grow]"); mig.setRowConstraints("[][fill, grow]"); setLayout(mig); refreshLayout(); }
Example 2
Source File: PlayersJList.java From magarena with GNU General Public License v3.0 | 6 votes |
@Override public Component getListCellRendererComponent( JList<? extends PlayerProfile> list, PlayerProfile profile, int index, boolean isSelected, boolean cellHasFocus) { this.profile = profile; foreColor = isSelected ? MagicStyle.getRolloverColor() : Color.WHITE; final MigLayout migLayout = new MigLayout("insets 0, gap 0"); final JPanel panel = new JPanel(migLayout); migLayout.setColumnConstraints("4[66][][align right]4"); panel.setPreferredSize(new Dimension(getWidth(), 70)); panel.setOpaque(false); panel.setBorder(isSelected ? BorderFactory.createLineBorder(MagicStyle.getRolloverColor(), 1) : null); panel.add(getAvatarPortrait(), "h 70!"); panel.add(getNamePanel(), "w 200!"); panel.add(new PlayerMiniStatsPanel(profile.getStats(), foreColor), "pushx"); return panel; }
Example 3
Source File: MenuScreenContentPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
public MenuScreenContentPanel(String title, boolean showKeyStripPanel) { mp = new MenuPanel(title); final MigLayout layout = new MigLayout(); layout.setLayoutConstraints("insets 0, gap 0, flowy"); layout.setRowConstraints("[30!][100%, center][30!, bottom]"); layout.setColumnConstraints("[center, fill, grow]"); setLayout(layout); add(mp, "cell 0 1"); if (showKeyStripPanel) { add(new KeysStripPanel()); } setOpaque(false); }
Example 4
Source File: DuelSideBarPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
public void doSetLayout() { final int insets = 6; final int maxWidth = DefaultResolutionProfile.getPanelWidthLHS() - (insets * 2); final MigLayout layout = new MigLayout("insets " + insets + ", gap 0 6, flowy"); layout.setColumnConstraints( "[" + maxWidth + "!, fill]" ); setLayout(layout); removeAll(); for (LayoutSlot slot : layoutSlots) { add(slot.getComponent(), slot.getLayoutConstraints()); } // IMPORTANT! Ensures you do not "see" it laying out components (when running duel directly). revalidate(); }
Example 5
Source File: DeckInfoPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
public DeckInfoPanel() { this.statsViewer = new DeckStatisticsViewer(); this.descViewer = new DeckDescriptionViewer(); final MigLayout mig = new MigLayout(); setLayout(mig); mig.setLayoutConstraints("flowy, insets 0, gap 0"); mig.setColumnConstraints("[fill, grow]"); mig.setRowConstraints("[][fill, grow]"); refreshLayout(); statsViewer.addPropertyChangeListener( DeckStatisticsViewer.CP_LAYOUT_CHANGED, (e) -> { refreshLayout(); firePropertyChange(CP_LAYOUT_CHANGED, true, false); } ); setBackground(FontsAndBorders.TRANSLUCENT_WHITE_STRONG); }
Example 6
Source File: VclTestApp.java From cuba with Apache License 2.0 | 5 votes |
private Component createAlignTab() { JPanel box = new JPanel(); box.setFocusable(false); MigLayout boxLayout = new MigLayout("debug 1000, fill"); box.setLayout(boxLayout); JPanel panel = new JPanel(); MigLayout layout = new MigLayout("debug 1000, fill"); panel.setLayout(layout); JLabel label = new JLabel("Label"); CC cc = new CC(); cc.alignX("right").alignY("50%"); panel.add(label); layout.setComponentConstraints(label, cc); LC lc = new LC(); lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it. lc.debug(1000); AC rowConstr = new AC(); AC colConstr = new AC(); lc.fillX(); lc.flowY(); lc.gridGapY("0"); layout.setLayoutConstraints(lc); layout.setRowConstraints(rowConstr); layout.setColumnConstraints(colConstr); box.add(panel, "height 100px, width 100px"); layout.setComponentConstraints(label, cc); return box; }
Example 7
Source File: HeaderFooterScreen.java From magarena with GNU General Public License v3.0 | 5 votes |
private void setMigLayout() { final MigLayout layout = new MigLayout(); layout.setLayoutConstraints("insets 0, gap 0, flowy"); layout.setRowConstraints("[50!][100%, fill, grow][]"); layout.setColumnConstraints("[center, fill, grow]"); setLayout(layout); }
Example 8
Source File: NewMenuScreenContentPanel.java From magarena with GNU General Public License v3.0 | 5 votes |
public NewMenuScreenContentPanel() { mp = new NewMenuPanel(); final MigLayout layout = new MigLayout(); layout.setLayoutConstraints("insets 0, gap 0, flowy"); layout.setRowConstraints("[30!][100%, center][30!, bottom]"); layout.setColumnConstraints("[center, fill, grow]"); setLayout(layout); add(mp, "cell 0 1"); refreshStyle(); setOpaque(false); }
Example 9
Source File: CardFilterPanel.java From magarena with GNU General Public License v3.0 | 5 votes |
private void refreshLayout() { MigLayout layout = new MigLayout(); layout.setLayoutConstraints("flowy, wrap 2, gap 4"); layout.setColumnConstraints("fill, 66:108"); layout.setRowConstraints("fill, 36"); setLayout(layout); // layout buttons in columns over two rows. for (FilterPanel fb : filterButtons) { add(fb); } add(resetButton); }
Example 10
Source File: DeckDescriptionViewer.java From magarena with GNU General Public License v3.0 | 5 votes |
public DeckDescriptionViewer() { setOpaque(false); final TitleBar titleBar = new TitleBar(MText.get(_S1)); textArea = new JTextArea(); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setBackground(FontsAndBorders.TEXTAREA_TRANSPARENT_COLOR_HACK); scrollPane = new JScrollPane(textArea); scrollPane.getVerticalScrollBar().setUnitIncrement(8); scrollPane.setBorder(null); scrollPane.getViewport().setOpaque(false); scrollPane.setMinimumSize(new Dimension(0, 0)); scrollPane.setPreferredSize(new Dimension(getWidth(), 0)); setMinimumSize(new Dimension(0, titleBar.getMinimumSize().height)); final MigLayout mig = new MigLayout(); mig.setLayoutConstraints("flowy, insets 0, gap 0"); mig.setColumnConstraints("[fill, grow]"); mig.setRowConstraints("[][fill, grow]"); setLayout(mig); add(titleBar); add(scrollPane); }
Example 11
Source File: StatsTable.java From magarena with GNU General Public License v3.0 | 4 votes |
void setStats(CardStatistics stats) { final MigLayout mig = new MigLayout("wrap 12, gapx 5"); mig.setColumnConstraints("[center][20!, center]"); mig.setRowConstraints("[][]0[]6[][]"); final JPanel panel = new JPanel(mig); panel.setOpaque(false); // headings panel.add(new JLabel()); panel.add(getHeadingLabel("Σ", MText.get(_S11))); panel.add(getHeadingLabel(MagicIcon.LAND, MText.get(_S1), stats.totalTypes[0])); panel.add(getHeadingLabel(MagicIcon.CREATURE, MText.get(_S2), stats.totalTypes[1])); panel.add(getHeadingLabel(MagicIcon.ARTIFACT, MText.get(_S3), stats.totalTypes[2])); panel.add(getHeadingLabel(MagicIcon.ENCHANTMENT, MText.get(_S4), stats.totalTypes[3])); panel.add(getHeadingLabel(MagicIcon.INSTANT, MText.get(_S5), stats.totalTypes[4])); panel.add(getHeadingLabel(MagicIcon.SORCERY, MText.get(_S6), stats.totalTypes[5])); panel.add(getHeadingLabel(MagicIcon.PLANESWALKER, MText.get(_S7), stats.totalTypes[6])); panel.add(getHeadingLabel(MagicManaType.Colorless, MText.get(_S8))); panel.add(getHeadingLabel("=1", MText.get(_S9))); panel.add(getHeadingLabel(">1", MText.get(_S10))); // totals panel.add(new JLabel("Σ")); panel.add(getValueLabel(stats.totalCards)); panel.add(getValueLabel(stats.totalTypes[0])); panel.add(getValueLabel(stats.totalTypes[1])); panel.add(getValueLabel(stats.totalTypes[2])); panel.add(getValueLabel(stats.totalTypes[3])); panel.add(getValueLabel(stats.totalTypes[4])); panel.add(getValueLabel(stats.totalTypes[5])); panel.add(getValueLabel(stats.totalTypes[6])); panel.add(getValueLabel(stats.colorless)); panel.add(getValueLabel(stats.monoColor)); panel.add(getValueLabel(stats.multiColor)); // % panel.add(new JLabel("%")); panel.add(getPercentageLabel(stats, stats.totalCards)); panel.add(getPercentageLabel(stats, stats.totalTypes[0])); panel.add(getPercentageLabel(stats, stats.totalTypes[1])); panel.add(getPercentageLabel(stats, stats.totalTypes[2])); panel.add(getPercentageLabel(stats, stats.totalTypes[3])); panel.add(getPercentageLabel(stats, stats.totalTypes[4])); panel.add(getPercentageLabel(stats, stats.totalTypes[5])); panel.add(getPercentageLabel(stats, stats.totalTypes[6])); panel.add(getPercentageLabel(stats, stats.colorless)); panel.add(getPercentageLabel(stats, stats.monoColor)); panel.add(getPercentageLabel(stats, stats.multiColor)); for (int i = 0; i < stats.colorCount.length; i++) { final boolean hasColor = stats.colorCount[i] > 0; final JLabel label = new JLabel(); if (hasColor) { label.setIcon(manaIconOn[i]); } else { label.setIcon(manaIconOff[i]); label.setForeground(Color.GRAY); } panel.add(label); panel.add(getValueLabel(stats.colorCount[i], hasColor)); panel.add(getValueLabel(stats.colorLands[i], hasColor && stats.totalTypes[0] > 0)); panel.add(getValueLabel(stats.colorCreatures[i], hasColor && stats.totalTypes[1] > 0)); panel.add(getValueLabel(stats.colorArtifacts[i], hasColor && stats.totalTypes[2] > 0)); panel.add(getValueLabel(stats.colorEnchantments[i], hasColor && stats.totalTypes[3] > 0)); panel.add(getValueLabel(stats.colorInstants[i], hasColor && stats.totalTypes[4] > 0)); panel.add(getValueLabel(stats.colorSorcery[i], hasColor && stats.totalTypes[5] > 0)); panel.add(getValueLabel(stats.colorPlaneswalkers[i], hasColor && stats.totalTypes[6] > 0)); panel.add(getLabel("---", false)); panel.add(getValueLabel(stats.colorMono[i], hasColor)); panel.add(getLabel("---", false)); } removeAll(); add(panel); revalidate(); }
Example 12
Source File: PlayerStatsPanel.java From magarena with GNU General Public License v3.0 | 3 votes |
PlayerStatsPanel(PlayerStatistics stats) { final MigLayout miglayout = new MigLayout("wrap 2, insets 2"); miglayout.setColumnConstraints("[50%][50%, right]"); setLayout(miglayout); setOpaque(false); refreshStats(getPlayerStatsViewerInfo(stats)); }