Download Jar. Uses 3874K of libraries. Click here for Pure Java version (2682L/19K).
!7 import javax.swing.plaf.LayerUI; static class ZoomUI extends LayerUI<JComponent> { double zoom = 1.5; public void paint(Graphics g, JComponent c) { Graphics2D g2 = (Graphics2D) g.create(); g2.scale(zoom, zoom); super.paint(g2, c); g2.dispose(); } public void installUI(JComponent c) { super.installUI(c); JLayer jlayer = (JLayer)c; jlayer.setLayerEventMask( AWTEvent.MOUSE_EVENT_MASK | AWTEvent.ACTION_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK ); } @Override public void uninstallUI(JComponent c) { JLayer jlayer = (JLayer)c; jlayer.setLayerEventMask(0); super.uninstallUI(c); } protected void processMouseEvent(MouseEvent e, JLayer l) { /*l.getView().dispatchEvent(new MouseEvent(e.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), iround(e.getX()/zoom), iround(e.getY()/zoom), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton())); e.consume();*/ } protected void processMouseMotionEvent(MouseEvent e, JLayer l) { processMouseEvent(e, l); } } p-substance { LayerUI<JComponent> layerUI = new ZoomUI; JPanel panel = createPanel(); JLayer<JComponent> jlayer = new JLayer<JComponent>(panel, layerUI); centerFrame(setFrameSize(showFrame(jlayer), 300, 200)); } static JPanel createPanel() { JPanel p = new JPanel(); ButtonGroup entreeGroup = new ButtonGroup(); JRadioButton radioButton; p.add(radioButton = new JRadioButton("Beef", true)); entreeGroup.add(radioButton); p.add(radioButton = new JRadioButton("Chicken")); entreeGroup.add(radioButton); p.add(radioButton = new JRadioButton("Vegetable")); entreeGroup.add(radioButton); p.add(new JCheckBox("Ketchup")); p.add(new JCheckBox("Mustard")); p.add(new JCheckBox("Pickles")); p.add(new JLabel("Special requests:")); p.add(new JTextField(20)); JButton orderButton = new JButton("Place Order"); p.add(orderButton); return p; }
Began life as a copy of #1009901
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009902 |
Snippet name: | Zoomed Swing [dev.] |
Eternal ID of this version: | #1009902/5 |
Text MD5: | 96f01f4898e9f867b04efaffe8280ded |
Transpilation MD5: | 5d809906a82b68475bee1cc253c77b9c |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-24 00:33:52 |
Source code size: | 2166 bytes / 81 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 654 / 1559 |
Version history: | 4 change(s) |
Referenced in: | [show references] |