本文整理匯總了Java中java.awt.ComponentOrientation類的典型用法代碼示例。如果您正苦於以下問題:Java ComponentOrientation類的具體用法?Java ComponentOrientation怎麽用?Java ComponentOrientation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ComponentOrientation類屬於java.awt包,在下文中一共展示了ComponentOrientation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initPanneauBoutonValidation
import java.awt.ComponentOrientation; //導入依賴的package包/類
/**
* Initialise le panneau du bouton de validation
*/
private void initPanneauBoutonValidation(){
this.setPanneauBoutousValidation(new JPanel());
this.getPanneauBoutousValidation().setLayout(new BoxLayout(this.getPanneauBoutousValidation(), BoxLayout.LINE_AXIS));
this.getPanneauBoutousValidation().setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
this.setBoutonValider(new JButton("Valider"));
this.setBoutonAnnule(new JButton("Annuler"));
this.getPanneauBoutousValidation().add(this.getBoutonValider());
this.getPanneauBoutousValidation().add(Box.createRigidArea(new Dimension(10, 0)));
this.getPanneauBoutousValidation().add(this.getBoutonAnnule());
this.getPanneauBoutousValidation().add(Box.createHorizontalGlue());
this.getContentPane().add(this.getPanneauBoutousValidation());
this.getPanneauBoutousValidation().setVisible(true);
}
示例2: changeOrientationOfJPanelToRight
import java.awt.ComponentOrientation; //導入依賴的package包/類
public void changeOrientationOfJPanelToRight() {
thePanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
Component panelComponents[] = thePanel.getComponents();
for (int i = 0; i < panelComponents.length; i++) {
if(panelComponents[i] instanceof JPanel) {
JPanel panel = (JPanel) panelComponents[i];
if(panel.getComponentOrientation().isLeftToRight()) {
panel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
}
}
if(panelComponents[i] instanceof JButton) {
JButton button = (JButton) panelComponents[i];
if(button.getComponentOrientation().isLeftToRight()) {
button.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
}
}
}
}
開發者ID:Coder-ACJHP,項目名稱:Hotel-Properties-Management-System,代碼行數:23,代碼來源:ChangeComponentOrientation.java
示例3: changeOrientationOfJPanelToLeft
import java.awt.ComponentOrientation; //導入依賴的package包/類
public void changeOrientationOfJPanelToLeft() {
thePanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
Component panelComponents[] = thePanel.getComponents();
for (int i = 0; i < panelComponents.length; i++) {
if(panelComponents[i] instanceof JPanel) {
JPanel panel = (JPanel) panelComponents[i];
if(!panel.getComponentOrientation().isLeftToRight()) {
panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
}
}
if(panelComponents[i] instanceof JButton) {
JButton button = (JButton) panelComponents[i];
if(!button.getComponentOrientation().isLeftToRight()) {
button.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
}
}
}
}
開發者ID:Coder-ACJHP,項目名稱:Hotel-Properties-Management-System,代碼行數:23,代碼來源:ChangeComponentOrientation.java
示例4: setComponentOrientation
import java.awt.ComponentOrientation; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public void setComponentOrientation(ComponentOrientation o) {
// Some LaFs might do fun stuff, resulting in this method being called
// before a border is installed.
if (getBorder() instanceof GutterBorder) {
// Reuse the border to preserve its color.
if (o.isLeftToRight()) {
((GutterBorder)getBorder()).setEdges(0, 0, 0, 1);
}
else {
((GutterBorder)getBorder()).setEdges(0, 1, 0, 0);
}
}
super.setComponentOrientation(o);
}
示例5: TestFrame
import java.awt.ComponentOrientation; //導入依賴的package包/類
public TestFrame() {
super("TestFrame");
// The change of the orientation and the reverse order of
// adding the buttons to the panel is because in Container.removeNotify()
// the child components are removed in the reverse order.
// We want that the focus owner (b0) would be removed first and
// that the next traversable component would be b1.
panel0.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
panel0.add(b2);
panel0.add(b1);
panel0.add(b0);
panel1.add(b3);
panel1.add(b4);
setLayout(new FlowLayout());
add(panel0);
add(panel1);
pack();
panel0.setBackground(Color.red);
panel1.setBackground(Color.blue);
}
示例6: validateThird
import java.awt.ComponentOrientation; //導入依賴的package包/類
public void validateThird() {
JViewport viewport = this.pane.getViewport();
JScrollBar scroller = this.pane.getHorizontalScrollBar();
if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) {
throw new Error("unexpected component orientation");
}
int value = scroller.getValue();
if (value != 0) {
throw new Error("unexpected scroll value");
}
int extent = viewport.getExtentSize().width;
if (extent != scroller.getVisibleAmount()) {
throw new Error("unexpected visible amount");
}
int size = viewport.getViewSize().width;
if (size != scroller.getMaximum()) {
throw new Error("unexpected maximum");
}
int pos = size - extent - value;
if (pos != viewport.getViewPosition().x) {
throw new Error("unexpected position");
}
}
示例7: TestInvariants
import java.awt.ComponentOrientation; //導入依賴的package包/類
static void TestInvariants() {
System.out.println(" TestInvariants {");
Assert(ComponentOrientation.LEFT_TO_RIGHT.isLeftToRight(),
"LEFT_TO_RIGHT.isLeftToRight()");
Assert(ComponentOrientation.UNKNOWN.isLeftToRight(),
"UNKNOWN.isLeftToRight()");
Assert(!ComponentOrientation.RIGHT_TO_LEFT.isLeftToRight(),
"!RIGHT_TO_LEFT.isLeftToRight()");
Assert(ComponentOrientation.LEFT_TO_RIGHT.isHorizontal(),
"LEFT_TO_RIGHT.isHorizontal()");
Assert(ComponentOrientation.UNKNOWN.isHorizontal(),
"UNKNOWN.isHorizontal()");
Assert(ComponentOrientation.RIGHT_TO_LEFT.isHorizontal(),
"RIGHT_TO_LEFT.isHorizontal()");
System.out.println(" } Pass");
}
示例8: showFileChooser
import java.awt.ComponentOrientation; //導入依賴的package包/類
private static void showFileChooser() throws Exception {
if (tryLookAndFeel(lookAndFeelComboBox.getSelectedItem().toString())) {
openChooser = new JFileChooser();
ComponentOrientation orientation
= ComponentOrientation.UNKNOWN;
switch (orientationComboBox.getSelectedItem().toString()) {
case orientationLTR:
orientation = ComponentOrientation.LEFT_TO_RIGHT;
break;
case orientationRTL:
orientation = ComponentOrientation.RIGHT_TO_LEFT;
break;
}
openChooser.setComponentOrientation(orientation);
openChooser.showOpenDialog(frame);
}
}
示例9: FileTree
import java.awt.ComponentOrientation; //導入依賴的package包/類
/** Construct a FileTree */
public FileTree(File dir) {
setLayout(new BorderLayout());
applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
setBorder(null);
// Make a tree list with all the nodes, and make it a JTree
JTree tree = new JTree(addNodes(null, dir));
tree.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
// Add a listener
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e
.getPath().getLastPathComponent();
}
});
add(BorderLayout.CENTER, tree);
JScrollPane scrollBarExplorer = new JScrollPane();
scrollBarExplorer.getViewport().add(tree);
scrollBarExplorer.setBorder(null);
add(scrollBarExplorer, BorderLayout.CENTER);
}
示例10: JFilePicker
import java.awt.ComponentOrientation; //導入依賴的package包/類
public JFilePicker(String textFieldLabel, String buttonLabel) {
setLayout(new FlowLayout(FlowLayout.CENTER, 5, 1));
// creates the GUI
label = new JLabel(textFieldLabel);
label.setFont(new Font("Arial", Font.BOLD, 16));
textField = new JTextField(30);
textField.setFont(new Font("Arial", Font.PLAIN, 12));
textField.setText(WorkspaceFile.getPathWorkspace());
button = new JButton(buttonLabel);
button.setFont(new Font("Arial", Font.BOLD, 14));
label.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
textField.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
button.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
add(button);
add(textField);
add(label);
button.addActionListener(this);
}
示例11: getLastVisibleRowIndex
import java.awt.ComponentOrientation; //導入依賴的package包/類
/**
* Returns the row index of the last visible row.
*
*/
int getLastVisibleRowIndex(JTable table)
{
ComponentOrientation or = table.getComponentOrientation();
Rectangle r = table.getVisibleRect();
r.translate(0, (int) r.getHeight() - 1);
if (or.isLeftToRight())
r.translate((int) r.getWidth() - 1, 0);
// The next if makes sure that we don't return -1 simply because
// there is white space at the bottom of the table (ie, the display
// area is larger than the table)
if (table.rowAtPoint(r.getLocation()) == -1)
{
if (getFirstVisibleRowIndex(table) == -1)
return -1;
else
return table.getModel().getRowCount() - 1;
}
return table.rowAtPoint(r.getLocation());
}
示例12: displayView
import java.awt.ComponentOrientation; //導入依賴的package包/類
/**
* Displays this panel in a modal resizable dialog box.
*/
public void displayView(View parentView)
{
String dialogTitle = preferences.getLocalizedString(PrintPreviewPanel.class, "printPreview.title");
JOptionPane optionPane = new JOptionPane(this, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
if (parentView != null)
{
optionPane.setComponentOrientation(((JComponent) parentView).getComponentOrientation());
}
JDialog dialog = optionPane.createDialog(SwingUtilities.getRootPane((JComponent) parentView), dialogTitle);
dialog.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
dialog.setResizable(true);
// Pack again because resize decorations may have changed dialog preferred size
dialog.pack();
dialog.setMinimumSize(dialog.getPreferredSize());
dialog.setVisible(true);
dialog.dispose();
}
示例13: getPageAxisConstant
import java.awt.ComponentOrientation; //導入依賴的package包/類
public static int getPageAxisConstant()
{
if (PlatformFriend.RUNNING_ON_JAVA_14_OR_HIGHER)
{
return BoxLayout.PAGE_AXIS;
}
else
{
ComponentOrientation componentOrientation = ComponentOrientation.getOrientation(Locale.getDefault());
if (componentOrientation.isHorizontal())
return BoxLayout.Y_AXIS;
else
return BoxLayout.X_AXIS;
}
}
示例14: AbstractFormBuilder
import java.awt.ComponentOrientation; //導入依賴的package包/類
/**
* Constructs a <code>AbstractFormBuilder</code>
* for the given FormLayout and layout container.
*
* @param layout the {@link FormLayout} to use
* @param container the layout container
*
* @throws NullPointerException if the layout or container is null
*/
public AbstractFormBuilder(FormLayout layout, Container container) {
if (layout == null)
throw new NullPointerException("The layout must not be null.");
if (container == null)
throw new NullPointerException("The layout container must not be null.");
this.container = container;
this.layout = layout;
container.setLayout(layout);
currentCellConstraints = new CellConstraints();
ComponentOrientation orientation = container.getComponentOrientation();
leftToRight = orientation.isLeftToRight()
|| !orientation.isHorizontal();
}
示例15: EnginePanel
import java.awt.ComponentOrientation; //導入依賴的package包/類
/**
* Creates a new instance using the specified parameters.
*
* @param player the {@link Player} this panel is to represent.
* @param orientation the current {@link ComponentOrientation}.
* @param engineSettings the settings panel for this {@link Player} or
* {@code null}.
* @param configuration the {@link PmsConfiguration}.
* @param tabListenerRegistrar the {@link TranscodingTabListenerRegistrar}.
*/
public EnginePanel(
@Nonnull Player player,
@Nonnull ComponentOrientation orientation,
@Nullable JComponent engineSettings,
@Nonnull PmsConfiguration configuration,
@Nullable TranscodingTabListenerRegistrar tabListenerRegistrar
) {
super(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
if (player == null) {
throw new IllegalArgumentException("player cannot be null");
}
if (orientation == null) {
throw new IllegalArgumentException("orientation cannot be null");
}
this.player = player;
this.orientation = orientation;
this.engineSettings = engineSettings;
this.configuration = configuration;
this.cardListenerRegistrar =
tabListenerRegistrar == null ?
null :
new CardListenerRegistrar(tabListenerRegistrar, this);
build();
}