net.miginfocom.swing.MigLayout Java Examples
The following examples show how to use
net.miginfocom.swing.MigLayout.
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: ReportPanel.java From freecol with GNU General Public License v2.0 | 6 votes |
/** * Creates the basic FreeCol report panel. * * @param freeColClient The {@code FreeColClient} for the game. * @param key A key for the title. */ protected ReportPanel(FreeColClient freeColClient, String key) { super(freeColClient, "ReportPanelUI", new MigLayout("wrap 1", "[fill]", "[]30[fill]30[]")); header = Utility.localizedHeader(Messages.nameKey(key), false); add(header, "cell 0 0, align center"); reportPanel = new MigPanel("ReportPanelUI"); reportPanel.setOpaque(true); reportPanel.setBorder(createBorder()); scrollPane = new JScrollPane(reportPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.getVerticalScrollBar().setUnitIncrement( 16 ); add(scrollPane, SCROLL_PANE_SIZE); add(okButton, "cell 0 2, tag ok"); float scale = getImageLibrary().getScaleFactor(); getGUI().restoreSavedSize(this, new Dimension(200 + (int)(scale*850), 200 + (int)(scale*525))); }
Example #2
Source File: BasicDialog.java From nanoleaf-desktop with MIT License | 6 votes |
public BasicDialog() { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setUndecorated(true); contentPanel.setLayout(new MigLayout("", "[432.00,grow]", "[][]")); contentPanel.setBackground(Color.DARK_GRAY); contentPanel.setBorder(new LineBorder(new Color(128, 128, 128), 2)); setContentPane(contentPanel); WindowDragListener wdl = new WindowDragListener(50); addMouseListener(wdl); addMouseMotionListener(wdl); CloseButton btnClose = new CloseButton(this, JFrame.DISPOSE_ON_CLOSE); contentPanel.add(btnClose, "cell 0 0,alignx right,gapx 0 15"); }
Example #3
Source File: StackViewer.java From magarena with GNU General Public License v3.0 | 6 votes |
private void refreshLayout() { stackScrollablePanel = new ScrollablePanel(); stackScrollablePanel.setLayout(new MigLayout("insets 0, gap 0, flowy")); stackScrollablePanel.setOpaque(false); stackScrollPane = new JScrollPane(stackScrollablePanel); stackScrollPane.setMinimumSize(new Dimension(0, 0)); stackScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); stackScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); stackScrollPane.setBorder(null); stackScrollPane.setOpaque(false); stackScrollPane.getViewport().setOpaque(false); removeAll(); setLayout(new MigLayout("insets 0, gap 0, flowy")); add(stackScrollPane, "w 100%"); }
Example #4
Source File: ListSelectDialog.java From gameserver with Apache License 2.0 | 6 votes |
public ListSelectDialog(DefaultListModel listModel, ListCellRenderer cellRender) { this.listModel = listModel; list.setModel(listModel); list.setCellRenderer(cellRender); list.setSortable(true); list.setRolloverEnabled(true); list.addHighlighter(HighlighterFactory.createAlternateStriping()); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane pane = new JScrollPane(list); this.setMinimumSize(new Dimension(250, 400)); this.setModal(true); this.setLayout(new MigLayout("wrap 1")); this.add(pane, "width 100%, height 85%, grow"); this.add(new JXLabel("用Ctrl-F可以搜索列表")); JXButton okButton = new JXButton("确定"); okButton.addActionListener(this); this.add(okButton, "align center"); this.setLocation((MainFrame.screenWidth-200)/2, (MainFrame.screenHeight-400)/2); this.setVisible(true); }
Example #5
Source File: JDADecompilerSettings.java From java-disassembler with GNU General Public License v3.0 | 6 votes |
/** * This must be called OUTSIDE the constructor, because otherwise it will get called BEFORE any plugins load. */ private void initPipelineGui() { pipelinePanel = new JPanel(new MigLayout("gap rel 0", "grow")); pipelinePanel.add(new JLabel("Preprocessing Pipeline"), "wrap"); availFilters = new CheckboxList(); for (DecompileFilter filter : DecompileFilters.getAllFilters()) { JCheckBox checkbox = new JCheckBox(filter.getFullName()); checkbox.addItemListener((e) -> { if (checkbox.isSelected()) enabledFilters.add(filter); else enabledFilters.remove(filter); }); filterCheckboxes.put(filter, checkbox); availFilters.addCheckbox(checkbox); } pipelineListbox = new JScrollPane(availFilters); pipelinePanel.add(pipelineListbox, "spanx, grow"); dialog.add(pipelinePanel, "align center, spanx, grow, wrap"); }
Example #6
Source File: ShortcutInfoPanel.java From lnk2pwn with MIT License | 6 votes |
@PostConstruct private void initComponents() { this.setLayout(new MigLayout("", "[grow]", "")); targetPathField.getDocument().addDocumentListener(this); workingDirField.getDocument().addDocumentListener(this); argumentsField.getDocument().addDocumentListener(this); shortcutFileNameField.getDocument().addDocumentListener(this); fakeExtensionField.getDocument().addDocumentListener(this); iconPathField.getDocument().addDocumentListener(this); iconIndexField.getDocument().addDocumentListener(this); targetPathField.setText(DEFAULT_TARGET_PATH); workingDirField.setText(DEFAULT_WORKING_DIR); argumentsField.setText(DEFAULT_ARGUMENTS); fakeExtensionField.setText(DEFAULT_FAKE_EXTENSION); iconPathField.setText(DEFAULT_ICON_DLL); WebPanel targetAndWorkingDirPanel = createTargetPathAndWorkingDirPanel(); WebPanel argumentsPanel = createArgumentsPanel(); WebPanel shortcutDetailsPanel = createShortcutDetailsPanel(); this.add(targetAndWorkingDirPanel, "grow,wrap"); this.add(argumentsPanel, "grow,wrap"); this.add(shortcutDetailsPanel, "grow,wrap"); }
Example #7
Source File: NotesPanel.java From osrsclient with GNU General Public License v2.0 | 6 votes |
public NotesPanel(){ super(new MigLayout()); setBackground(Color.BLACK); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new MigLayout()); buttonsPanel.setBackground(Color.BLACK); JButton increaseFontSize = new JButton("+"); JButton decreaseFontSize = new JButton("-"); buttonsPanel.add(increaseFontSize, "wrap, growx"); buttonsPanel.add(decreaseFontSize, "growx"); notewindow = new JTextArea(); JScrollPane scrollPane = new JScrollPane(notewindow); scrollPane.setBackground(Color.black); notewindow.setLineWrap(true); notewindow.setBackground(new Color(221, 221, 221)); notewindow.setFont(notewindow.getFont().deriveFont(initFontSize)); add(scrollPane, "height 200, width 200, dock center"); increaseFontSize.addActionListener(new AddListener()); decreaseFontSize.addActionListener(new SubListener()); add(buttonsPanel, "growy"); }
Example #8
Source File: EquipmentImportService.java From gameserver with Apache License 2.0 | 6 votes |
public EquipmentImportService(MyTableModel model, ShopDataPriceConfig config) { this.model = model; this.config = config; panel = new JXPanel(); panel.setLayout(new MigLayout("wrap 1")); panel.add(label, "growx, wrap 20"); panel.add(progressBar, "grow, push"); this.dialog = new JDialog(); this.dialog.add(panel); this.dialog.setSize(300, 120); Point p = WindowUtils.getPointForCentering(dialog); this.dialog.setLocation(p); this.dialog.setModal(true); this.dialog.setResizable(false); this.dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); }
Example #9
Source File: ListBrandPane.java From OpERP with MIT License | 6 votes |
public ListBrandPane() { pane = new JPanel(new MigLayout("fill")); table = new JTable(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2 && table.getSelectedRow() != -1) { Brand brand = tableModel.getRow(table.getSelectedRow()); brandDetailsPane.show(brand, getPane()); } } }); final JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane.add(scrollPane, "grow"); }
Example #10
Source File: SendBitcoinConfirmPanel.java From bither-desktop-java with Apache License 2.0 | 6 votes |
private JPanel getToAddressPanel() { JPanel panel = Panels.newPanel( new MigLayout( Panels.migXLayout(), "[][][][]", // Columns "[][]" // Rows )); panel.add(Labels.newValueLabel(LocaliserUtils.getString("send_confirm_address")), "push"); panel.add(Labels.newValueLabel(address), "push,wrap"); panel.add(Labels.newValueLabel(LocaliserUtils.getString("send_confirm_amount")), "push"); long to = tx.amountSentToAddress(address); panel.add(Labels.newValueLabel(UnitUtil.formatValue(to, UnitUtil.BitcoinUnit.BTC)) , "push,wrap"); return panel; }
Example #11
Source File: DeckColorLabel.java From magarena with GNU General Public License v3.0 | 6 votes |
DeckColorLabel(final String deckColorSymbols) { final int colorCount = deckColorSymbols.length(); if (colorCount > 0) { setLayout(new MigLayout("insets 0, gapx " + ICON_GAPX)); for (int i = 0; i < colorCount; i++) { final MagicManaType manaType = MagicColor.getColor(deckColorSymbols.charAt(i)).getManaType(); final JLabel iconLabel = new JLabel(MagicImages.getIcon(manaType, true)); add(iconLabel, "w 16!, h 16!"); } } final int preferredWidth = (colorCount * 16) + (colorCount * ICON_GAPX); setPreferredSize(new Dimension(preferredWidth, 16)); }
Example #12
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 #13
Source File: VanityOptionPanel.java From bither-desktop-java with Apache License 2.0 | 6 votes |
private JPanel getSelectThreadsCount() { JPanel panel = Panels.newPanel(new MigLayout(Panels.migXYLayout(), "[][]", // Column constraints "[]" // Row constraints)) )); spinnerCount = new JSpinner(); JLabel label = Labels.newValueLabel(LocaliserUtils.getString("thread_count")); panel.add(label, "align right,shrink "); panel.add(spinnerCount, "align center,shrink"); int cpuCount = SystemUtil.getAvailableProcessors(); Integer value = new Integer(cpuCount); Integer min = new Integer(1); Integer max = new Integer(cpuCount); Integer step = new Integer(1); SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step); spinnerCount.setModel(model); return panel; }
Example #14
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 #15
Source File: AddressCellRenderer.java From NSS with Apache License 2.0 | 6 votes |
void init(){ panel=new JPanel(); panel.setLayout(new MigLayout("insets 0 5 0 0","[grow,fill]rel[right]", "[]0[]")); panel.setOpaque(true); panel.setBackground(color_normal); addressLabel=new JLabel(""); panel.add(addressLabel,""); addressLabel.setOpaque(false); button_remove=new JButton("x"); //panel.add(button_remove,"align right"); button_remove.setOpaque(false); button_remove.setContentAreaFilled(false); button_remove.setBorderPainted(false); button_remove.setMargin(new Insets(0, 10, 0, 10)); button_remove.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println(e); } }); }
Example #16
Source File: DesktopFilter.java From cuba with Apache License 2.0 | 6 votes |
public DesktopFilter() { delegate = AppBeans.get(FilterDelegate.class); delegate.setFilter(this); LC topLc = new LC(); topLc.hideMode(3); topLc.insetsAll("0"); if (LayoutAdapter.isDebug()) { topLc.debug(1000); } MigLayout topLayout = new MigLayout(topLc); impl = new JPanel(topLayout); ComponentContainer layout = delegate.getLayout(); JComponent unwrap = DesktopComponentsHelper.getComposition(layout); impl.add(unwrap, "width 100%"); setWidth("100%"); delegate.setExpandedStateChangeListener(e -> fireExpandStateChange(e.isExpanded())); delegate.setCaptionChangedListener(this::updateCaption); }
Example #17
Source File: CraftStonePrintService.java From gameserver with Apache License 2.0 | 6 votes |
public CraftStonePrintService(CraftStoneResultModel model, CraftStonePrintConfig config, int count, MyTablePanel tablePanel) { this.model = model; this.config = config; this.count = count; this.tablePanel = tablePanel; this.model.setTotalCount(count); panel = new JXPanel(); panel.setLayout(new MigLayout("wrap 1")); panel.add(label, "growx, wrap 20"); panel.add(progressBar, "grow, push"); this.dialog = new JDialog(); this.dialog.add(panel); this.dialog.setSize(300, 120); Point p = WindowUtils.getPointForCentering(dialog); this.dialog.setLocation(p); this.dialog.setModal(true); this.dialog.setResizable(false); this.dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); }
Example #18
Source File: AboutPanel.java From bither-desktop-java with Apache License 2.0 | 6 votes |
@Override public void initialiseContent(JPanel panel) { panel.setLayout(new MigLayout( Panels.migXYLayout(), "[][][][][][][]", // Column constraints "[]10[][][][][]80[]20[][][]" // Row constraints )); // String version = System.getProperties().getProperty("Implementation-Version"); //System.out.println(System.getProperties()); panel.add(Labels.newValueLabel(LocaliserUtils.getString("version") + ": " + BitherSetting.VERSION), "push,align center,wrap"); panel.add(Buttons.newLaunchBrowserButton(getLaunchBrowserAction(), MessageKey.VISIT_WEBSITE), "wrap,align center"); }
Example #19
Source File: ColdDefaultPanel.java From bither-desktop-java with Apache License 2.0 | 6 votes |
@Override public void displayView(DisplayHint displayHint) { // panelMain = Panels.newPanel(); panelMain.removeAll(); panelMain.setLayout(new MigLayout( Panels.migXYLayout(), "20[][][][][]10", // Column constraints "[][80][][30][30][20]" // Row constraints )); if (Bither.getActionAddress() == null) { if (AddressManager.getInstance().hasHDMKeychain()) { panelMain.add(btnHDMCold, "shrink"); } } else { panelMain.add(btnAddress, "shrink"); panelMain.add(btnWatchOnlyQRCode, "shrink"); } panelMain.add(btnBitherColdWallet, "shrink"); panelMain.add(btnSignTransaction, "shrink"); }
Example #20
Source File: RecruitPanel.java From freecol with GNU General Public License v2.0 | 5 votes |
/** * The constructor to use. * * @param freeColClient The {@code FreeColClient} for the game. */ public RecruitPanel(FreeColClient freeColClient) { super(freeColClient, null, new MigLayout("wrap 1", "", "")); List<AbstractUnit> recruitables = getMyPlayer().getEurope() .getExpandedRecruitables(false); this.person = new JButton[recruitables.size()]; for (int i = 0; i < person.length; i++) { this.person[i] = new JButton(); this.person[i].setActionCommand(String.valueOf(i)); this.person[i].addActionListener(this); this.person[i].setIconTextGap(MARGIN); } update(); }
Example #21
Source File: KeywordPanelA.java From magarena with GNU General Public License v3.0 | 5 votes |
KeywordPanelA(Keyword keyword) { setLayout(new MigLayout("insets 0, gap 0, flowy")); setOpaque(false); final JLabel nameLabel = new JLabel(keyword.getName()); nameLabel.setForeground(NAME_COLOR); nameLabel.setFont(FontsAndBorders.FONT2); add(nameLabel, "w 100%"); final JLabel descriptionLabel = new JLabel(); descriptionLabel.setText(keyword.getDescriptionAsHtml()); descriptionLabel.setForeground(TEXT_COLOR); add(descriptionLabel, "w 10:100%"); }
Example #22
Source File: FilterDialog.java From magarena with GNU General Public License v3.0 | 5 votes |
/** * Default layout. Variable sized main panel containing filter * values above fixed sized action bar. */ protected LayoutManager2 getLayoutManager() { return new MigLayout("flowy, gap 0, insets 0", "[fill, grow]", // column layout "[fill, grow]3[fill]" // row layout ); }
Example #23
Source File: Panels.java From bither-desktop-java with Apache License 2.0 | 5 votes |
/** * <p>A "seed phrase warning" panel displays the instructions to write down the seed phrase on a piece of paper</p> * * @return A new "seed phrase warning" panel */ public static JPanel newSeedPhraseWarning() { JPanel panel = Panels.newPanel( new MigLayout( Panels.migXLayout(), "[]", // Columns "[]" // Rows )); // Add to the panel panel.add(Labels.newCreateWalletPreparationNote(), "grow,push"); return panel; }
Example #24
Source File: BootloaderPanel.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
public BootloaderPanel(){ ////System.out.println("Starting GUI"); setText("NR Bootloader"); // fileButton = new JButton(); // fileButton.addActionListener(this); // resetFile(); loadButton = new JButton(); loadButton.addActionListener(this); resetLoad(); JPanel buttonPanel = new JPanel(new MigLayout()); //buttonPanel.add(fileStatus); // buttonPanel.add(fileButton, "wrap"); JPanel prog = new JPanel(new MigLayout()); prog.add(loadButton, "wrap"); prog.add(progress,"wrap"); buttonPanel.add(loadStatus); buttonPanel.add(prog); SwingNode sn = new SwingNode(); sn.setContent(buttonPanel); setContent(sn); }
Example #25
Source File: PIDVelocityWidget.java From BowlerStudio with GNU General Public License v3.0 | 5 votes |
public PIDVelocityWidget(PIDControlWidget w){ widget=w; setLayout(new MigLayout()); go.addActionListener(this); vel.addActionListener(this); time.addActionListener(this); vel.setText("100"); time.setText("0"); add(new JLabel("Velocity Control"),"wrap"); JPanel p = new JPanel(new MigLayout()); p.add(vel);p.add(new JLabel("ticks per second"),"wrap"); p.add(time);p.add(new JLabel("seconds"),"wrap"); add(p,"wrap"); add(go,"wrap"); }
Example #26
Source File: NationDetailPanel.java From freecol with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void buildDetail(String id, JPanel panel) { if (getId().equals(id)) return; Nation nation = getSpecification().getNation(id); Player player = CollectionUtils.find(getGame().getLivePlayers(), p -> p.getNation() == nation); NationType currentNationType = (player == null) ? nation.getType() : player.getNationType(); panel.setLayout(new MigLayout("wrap 3, fillx, gapx 20", "", "")); JLabel name = Utility.localizedHeaderLabel(nation, FontLibrary.FontSize.SMALL); panel.add(name, "span, align center, wrap 40"); JLabel artLabel = new JLabel(new ImageIcon(ImageLibrary.getMonarchImage(nation))); panel.add(artLabel, "spany, gap 40, top"); panel.add(Utility.localizedLabel("colopedia.nation.ruler")); panel.add(new JLabel(nation.getRulerName())); panel.add(Utility.localizedLabel("colopedia.nation.defaultAdvantage")); panel.add(getButton(nation.getType())); panel.add(Utility.localizedLabel("colopedia.nation.currentAdvantage")); panel.add(getButton(currentNationType), "wrap push"); }
Example #27
Source File: NationTypeDetailPanel.java From freecol with GNU General Public License v2.0 | 5 votes |
/** * Builds the details panel for the given nation type. * * @param nationType - the IndianNationType * @param panel the panel to use */ private void buildIndianNationTypeDetail(IndianNationType nationType, JPanel panel) { List<RandomChoice<UnitType>> skills = nationType.getSkills(); panel.setLayout(new MigLayout("wrap 2, gapx 20", "", "")); JLabel name = Utility.localizedHeaderLabel(nationType, FontLibrary.FontSize.SMALL); panel.add(name, "span, align center, wrap 40"); panel.add(Utility.localizedLabel("colopedia.nationType.aggression")); panel.add(Utility.localizedLabel("colopedia.nationType." + nationType.getAggression().getKey())); panel.add(Utility.localizedLabel("colopedia.nationType.settlementNumber")); panel.add(Utility.localizedLabel("colopedia.nationType." + nationType.getNumberOfSettlements().getKey())); panel.add(Utility.localizedLabel("colopedia.nationType.typeOfSettlements")); panel.add(new JLabel(Messages.getName(nationType.getCapitalType()), new ImageIcon(getImageLibrary() .getScaledSettlementTypeImage(nationType.getCapitalType())), SwingConstants.CENTER)); List<String> regionNames = toList(map(nationType.getRegions(), n -> Messages.getName(n))); panel.add(Utility.localizedLabel("colopedia.nationType.regions")); panel.add(new JLabel(join(", ", regionNames))); panel.add(Utility.localizedLabel("colopedia.nationType.skills"), "top, newline 20"); GridLayout gridLayout = new GridLayout(0, 2); gridLayout.setHgap(10); JPanel unitPanel = new JPanel(gridLayout); unitPanel.setOpaque(false); for (RandomChoice<UnitType> choice : skills) { unitPanel.add(getUnitButton(choice.getObject())); } panel.add(unitPanel); }
Example #28
Source File: SalePane.java From OpERP with MIT License | 5 votes |
public void setSaleDescpanel(JPanel saleDescPanel) { MigLayout layout = (MigLayout) pane.getLayout(); Object constraints = layout.getComponentConstraints(this.saleDescPanel); pane.remove(this.saleDescPanel); pane.add(saleDescPanel, constraints); this.saleDescPanel = saleDescPanel; pane.validate(); }
Example #29
Source File: REPLPane.java From sciview with BSD 2-Clause "Simplified" License | 5 votes |
/** * Constructs an interpreter UI pane for a SciJava scripting REPL. * * @param context The SciJava application context to use */ public REPLPane(final Context context) { context.inject(this); output = new OutputPane(log); final JScrollPane outputScroll = new JScrollPane(output); outputScroll.setPreferredSize(new Dimension(440, 400)); repl = new ScriptREPL(context, output.getOutputStream()); repl.initialize(); final Writer writer = output.getOutputWriter(); final ScriptContext ctx = repl.getInterpreter().getEngine().getContext(); ctx.setErrorWriter(writer); ctx.setWriter(writer); vars = new VarsPane(context, repl); vars.setBorder(new EmptyBorder(0, 0, 8, 0)); prompt = new REPLEditor(repl, vars, output); context.inject(prompt); prompt.setREPLLanguage("Python"); final JScrollPane promptScroll = new JScrollPane(prompt); final JPanel bottomPane = new JPanel(); bottomPane.setLayout(new MigLayout("ins 0", "[grow,fill][pref]", "[grow,fill,align top]")); bottomPane.add(promptScroll, "spany 2"); final JSplitPane outputAndPromptPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, outputScroll, bottomPane); outputAndPromptPane.setResizeWeight(1); // outputAndPromptPane.setDividerSize(2); mainPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, vars, outputAndPromptPane); mainPane.setDividerSize(1); mainPane.setDividerLocation(0); }
Example #30
Source File: Palette.java From nanoleaf-desktop with MIT License | 5 votes |
private void initUI() { setLayout(new MigLayout("", "[]", "[]")); add(Box.createRigidArea(new Dimension(width, height)), "cell 0 0,alignx left,aligny top"); setBackground(Color.DARK_GRAY); palette = new ArrayList<Color>(); palette.add(new Color(255, 0, 0)); palette.add(new Color(0, 255, 0)); palette.add(new Color(0, 0, 255)); scrollBar = new JScrollBar(JScrollBar.HORIZONTAL); scrollBar.setUI(new ModernScrollBarUI()); scrollBar.setPreferredSize(new Dimension(width, 20)); scrollBar.setMaximum(11); scrollBar.setMinimum(0); scrollBar.setValue(0); scrollBar.setVisible(false); scrollBar.addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent e) { repaint(); } }); add(scrollBar, "cell 0 1"); addMouseListener(new MouseHandler()); }