List of usage examples for javax.swing SwingConstants HORIZONTAL
int HORIZONTAL
To view the source code for javax.swing SwingConstants HORIZONTAL.
Click Source Link
From source file:net.launchpad.jabref.plugins.ZentralSearch.java
public JPanel getOptionsPanel() { JPanel pan = new JPanel(); pan.setLayout(new java.awt.GridLayout(10, 1)); pan.add(new JLabel("The above query field has to be filled.")); pan.add(new JSeparator(SwingConstants.HORIZONTAL)); pan.add(new JLabel("Below are additional query options.")); pan.add(new JLabel("Search by author")); pan.add(author);/*from w w w .ja va 2s . co m*/ pan.add(new JLabel("Search by title")); pan.add(title); pan.add(new JLabel("Search the abstract")); pan.add(theAbstract); reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { author.setText(""); title.setText(""); theAbstract.setText(""); } }); pan.add(reset); return pan; }
From source file:components.ScrollablePicture.java
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { //Get the current position. int currentPosition = 0; if (orientation == SwingConstants.HORIZONTAL) { currentPosition = visibleRect.x; } else {/*from ww w .j av a 2s . c om*/ currentPosition = visibleRect.y; } //Return the number of pixels between currentPosition //and the nearest tick mark in the indicated direction. if (direction < 0) { int newPosition = currentPosition - (currentPosition / maxUnitIncrement) * maxUnitIncrement; return (newPosition == 0) ? maxUnitIncrement : newPosition; } else { return ((currentPosition / maxUnitIncrement) + 1) * maxUnitIncrement - currentPosition; } }
From source file:MainClass.java
public VolumeRenderer() { super(SwingConstants.HORIZONTAL); setSize(115, 15); }
From source file:layout.Find.java
public Find() { JLabel label = new JLabel("Find What:"); ;// ww w .ja va 2 s .com JTextField textField = new JTextField(); JCheckBox caseCheckBox = new JCheckBox("Match Case"); JCheckBox wrapCheckBox = new JCheckBox("Wrap Around"); JCheckBox wholeCheckBox = new JCheckBox("Whole Words"); JCheckBox backCheckBox = new JCheckBox("Search Backwards"); JButton findButton = new JButton("Find"); JButton cancelButton = new JButton("Cancel"); // remove redundant default border of check boxes - they would hinder // correct spacing and aligning (maybe not needed on some look and feels) caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label) .addGroup(layout.createParallelGroup(LEADING).addComponent(textField) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox) .addComponent(wholeCheckBox)) .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox) .addComponent(backCheckBox)))) .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton))); layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField) .addComponent(findButton)) .addGroup(layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox) .addComponent(wrapCheckBox)) .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox) .addComponent(backCheckBox))) .addComponent(cancelButton))); setTitle("Find"); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:MainClass.java
public VolumeEditor() { super(SwingConstants.HORIZONTAL); listeners = new Vector(); }
From source file:lookandfeel.SynthDialog.java
public SynthDialog() { JLabel label = new JLabel("Find What:"); ;//from w ww . j av a2s.co m JTextField textField = new JTextField(); JCheckBox caseCheckBox = new JCheckBox("Match Case"); JCheckBox wrapCheckBox = new JCheckBox("Wrap Around"); JCheckBox wholeCheckBox = new JCheckBox("Whole Words"); JCheckBox backCheckBox = new JCheckBox("Search Backwards"); JButton findButton = new JButton("Find"); JButton cancelButton = new JButton("Cancel"); // remove redundant default border of check boxes - they would hinder // correct spacing and aligning (maybe not needed on some look and feels) caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label) .addGroup(layout.createParallelGroup(LEADING).addComponent(textField) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox) .addComponent(wholeCheckBox)) .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox) .addComponent(backCheckBox)))) .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton))); layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField) .addComponent(findButton)) .addGroup(layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox) .addComponent(wrapCheckBox)) .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox) .addComponent(backCheckBox))) .addComponent(cancelButton))); setTitle("Find"); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:lookandfeel.SynthDialog.java
public SynthDialog() { JLabel label = new JLabel("Find What:");; JTextField textField = new JTextField(); JCheckBox caseCheckBox = new JCheckBox("Match Case"); JCheckBox wrapCheckBox = new JCheckBox("Wrap Around"); JCheckBox wholeCheckBox = new JCheckBox("Whole Words"); JCheckBox backCheckBox = new JCheckBox("Search Backwards"); JButton findButton = new JButton("Find"); JButton cancelButton = new JButton("Cancel"); // remove redundant default border of check boxes - they would hinder // correct spacing and aligning (maybe not needed on some look and feels) caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout);// w w w . jav a2s. co m layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup() .addComponent(label) .addGroup(layout.createParallelGroup(LEADING) .addComponent(textField) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(LEADING) .addComponent(caseCheckBox) .addComponent(wholeCheckBox)) .addGroup(layout.createParallelGroup(LEADING) .addComponent(wrapCheckBox) .addComponent(backCheckBox)))) .addGroup(layout.createParallelGroup(LEADING) .addComponent(findButton) .addComponent(cancelButton)) ); layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE) .addComponent(label) .addComponent(textField) .addComponent(findButton)) .addGroup(layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE) .addComponent(caseCheckBox) .addComponent(wrapCheckBox)) .addGroup(layout.createParallelGroup(BASELINE) .addComponent(wholeCheckBox) .addComponent(backCheckBox))) .addComponent(cancelButton)) ); setTitle("Find"); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:components.ScrollablePicture.java
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { if (orientation == SwingConstants.HORIZONTAL) { return visibleRect.width - maxUnitIncrement; } else {// w ww. ja v a 2 s. co m return visibleRect.height - maxUnitIncrement; } }
From source file:GroupLayoutTest.java
public FontFrame() { setTitle("GroupLayoutTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); ActionListener listener = new FontAction(); // construct components JLabel faceLabel = new JLabel("Face: "); face = new JComboBox(new String[] { "Serif", "SansSerif", "Monospaced", "Dialog", "DialogInput" }); face.addActionListener(listener);//w ww .ja v a 2 s.c om JLabel sizeLabel = new JLabel("Size: "); size = new JComboBox(new String[] { "8", "10", "12", "15", "18", "24", "36", "48" }); size.addActionListener(listener); bold = new JCheckBox("Bold"); bold.addActionListener(listener); italic = new JCheckBox("Italic"); italic.addActionListener(listener); sample = new JTextArea(); sample.setText("The quick brown fox jumps over the lazy dog"); sample.setEditable(false); sample.setLineWrap(true); sample.setBorder(BorderFactory.createEtchedBorder()); pane = new JScrollPane(sample); GroupLayout layout = new GroupLayout(getContentPane()); setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(faceLabel).addComponent(sizeLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(size).addComponent(face))) .addComponent(italic).addComponent(bold)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(pane) .addContainerGap())); layout.linkSize(SwingConstants.HORIZONTAL, new java.awt.Component[] { face, size }); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pane, GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(face).addComponent(faceLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(size).addComponent(sizeLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(italic, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(bold, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap())); }
From source file:com.ssn.ui.custom.component.SSNImageThumbnailControl.java
public SSNImageThumbnailControl getSsnImageThumbnailControl(String imagePath, int index) { //this.setLayout(); iF = 0;/*from w w w. j a v a 2 s.c om*/ BufferedImage thumbImg1 = null; this.index = index; BufferedImage image; String[] videoSupported = SSNConstants.SSN_VIDEO_FORMAT_SUPPORTED; final List<String> videoSupportedList = Arrays.asList(videoSupported); try { // add code to check file is video or image if video then write code to create thumbnail String fileExtention = imagePath.substring(imagePath.lastIndexOf(".") + 1, imagePath.length()); if (videoSupportedList.contains(fileExtention.toUpperCase())) { IMediaReader reader = null; try { if (true) { reader = ToolFactory.makeReader(imagePath); reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR); reader.addListener(new MediaListenerAdapter() { @Override public void onVideoPicture(IVideoPictureEvent event) { setVideoFrame(event.getImage()); iF++; } }); while (reader.readPacket() == null && iF == 0) ; thumbImg1 = SSNHelper.resizeImage(getVideoFrame(), 50, 50); } } catch (Throwable e) { e.printStackTrace(); } finally { if (reader != null) reader.close(); } } else { image = ImageIO.read(new File(imagePath)); thumbImg1 = SSNHelper.resizeImage(image, 50, 50); } } catch (IOException ex) { Logger.getLogger(SSNImageThumbnailControl.class.getName()).log(Level.SEVERE, null, ex); } ImageIcon imageIcon = new ImageIcon(thumbImg1); JLabel thumbnailLabel = new JLabel(imageIcon, SwingConstants.HORIZONTAL); JLabel closeLabel = new JLabel(new ImageIcon(getClass().getResource("/icon/remove-icon.png")), SwingConstants.HORIZONTAL); closeLabel.setFocusable(true); closeLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); this.add(thumbnailLabel); this.add(closeLabel); closeLabel.addMouseListener(this); this.setFocusable(true); this.setSize(new Dimension(50, 50)); this.setBackground(new Color(0, 0, 0, 1)); return this; }