java类java.awt.ComponentOrientation的实例源码

FenetreOption.java 文件源码 项目:Java_GestionProjet 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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);
}
ChangeComponentOrientation.java 文件源码 项目:Hotel-Properties-Management-System 阅读 16 收藏 0 点赞 0 评论 0
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);
            }
        }
    }
}
ChangeComponentOrientation.java 文件源码 项目:Hotel-Properties-Management-System 阅读 19 收藏 0 点赞 0 评论 0
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);
            }
        }
    }
}
Gutter.java 文件源码 项目:powertext 阅读 18 收藏 0 点赞 0 评论 0
/**
 * {@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);
}
ContainerFocusAutoTransferTest.java 文件源码 项目:jdk8u-jdk 阅读 26 收藏 0 点赞 0 评论 0
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);
}
Test6526631.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
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");
    }
}
ContainerFocusAutoTransferTest.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
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);
}
BasicTest.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
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");
}
JFileChooserOrientation.java 文件源码 项目:openjdk-jdk10 阅读 17 收藏 0 点赞 0 评论 0
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);

    }
}
Test6526631.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
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");
    }
}
FileTree.java 文件源码 项目:Mujeed-Arabic-Prolog 阅读 28 收藏 0 点赞 0 评论 0
/** 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);

 }
JFilePicker.java 文件源码 项目:Mujeed-Arabic-Prolog 阅读 18 收藏 0 点赞 0 评论 0
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);     
}
BasicTableUI.java 文件源码 项目:javify 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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());
}
ContainerFocusAutoTransferTest.java 文件源码 项目:openjdk9 阅读 24 收藏 0 点赞 0 评论 0
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);
}
BasicTest.java 文件源码 项目:openjdk9 阅读 29 收藏 0 点赞 0 评论 0
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");
}
JFileChooserOrientation.java 文件源码 项目:openjdk9 阅读 18 收藏 0 点赞 0 评论 0
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);

    }
}
Test6526631.java 文件源码 项目:openjdk9 阅读 22 收藏 0 点赞 0 评论 0
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");
    }
}
PrintPreviewPanel.java 文件源码 项目:SweetHome3D 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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();
}
LocaleFriend.java 文件源码 项目:balloonist 阅读 19 收藏 0 点赞 0 评论 0
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;
    }
}
AbstractFormBuilder.java 文件源码 项目:ComputerScienceGraduation 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 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();
}
EnginePanel.java 文件源码 项目:DigitalMediaServer 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 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();
}
HelpPane.java 文件源码 项目:SweetHome3D 阅读 27 收藏 0 点赞 0 评论 0
public void propertyChange(PropertyChangeEvent ev)
{
    // If help pane was garbage collected, remove this listener from preferences
    HelpPane helpPane = this.helpPane.get();
    UserPreferences preferences = (UserPreferences) ev.getSource();
    if (helpPane == null)
    {
        preferences.removePropertyChangeListener(UserPreferences.Property.LANGUAGE, this);
    }
    else
    {
        // Update frame title and search label with new locale
        if (helpPane.frame != null)
        {
            helpPane.frame.setTitle(preferences.getLocalizedString(HelpPane.class, "helpFrame.title"));
            helpPane.frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
        }
        helpPane.searchLabel
                .setText(SwingTools.getLocalizedLabelText(preferences, HelpPane.class, "searchLabel.text"));
        helpPane.searchTextField.setText("");
        helpPane.setMnemonics(preferences);
    }
}
BottomLegendToolbar.java 文件源码 项目:geoxygene 阅读 31 收藏 0 点赞 0 评论 0
public BottomLegendToolbar(ProjectFrame frame, LayerLegendPanel panel,
    GeOxygeneApplication appli) {
  super();
  this.setFrame(frame);
  this.setPanel(panel);
  this.setAppli(appli);

  this.initGeomBtn = new JButton(new ShowIniGeomAction(appli));
  this.rawDisplayBtn = new JToggleButton(new RawDisplayAction());
  this.idDisplayBtn = new JToggleButton(new DisplayIdAction());
  this.eliminatedBtn = new JToggleButton(new ShowEliminatedAction());

  this.add(rawDisplayBtn);
  this.add(initGeomBtn);
  this.add(idDisplayBtn);
  this.add(eliminatedBtn);
  this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
  this.setFloatable(false);
  this.setOrientation(HORIZONTAL);
}
ContainerFocusAutoTransferTest.java 文件源码 项目:jdk8u_jdk 阅读 23 收藏 0 点赞 0 评论 0
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);
}
Test6526631.java 文件源码 项目:jdk8u_jdk 阅读 27 收藏 0 点赞 0 评论 0
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");
    }
}
ContainerFocusAutoTransferTest.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 28 收藏 0 点赞 0 评论 0
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);
}
Test6526631.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 24 收藏 0 点赞 0 评论 0
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");
    }
}
AndroidUIUtil.java 文件源码 项目:j2se_for_android 阅读 20 收藏 0 点赞 0 评论 0
public static final int convertToGravity(int horizontalAlign, ComponentOrientation orien){
    if(orien == null){
        orien = ComponentOrientation.LEFT_TO_RIGHT;
    }

    if(horizontalAlign == SwingConstants.CENTER){
        return Gravity.CENTER | Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL;
    }else if(horizontalAlign == SwingConstants.LEFT 
            || (orien.isLeftToRight() && horizontalAlign == SwingConstants.LEADING)
            || (orien.isLeftToRight() == false && horizontalAlign == SwingConstants.TRAILING)){
        return Gravity.LEFT;
    }else if(horizontalAlign == SwingConstants.RIGHT 
            || (orien.isLeftToRight() == false && horizontalAlign == SwingConstants.LEADING)
            || (orien.isLeftToRight() && horizontalAlign == SwingConstants.TRAILING)){
        return Gravity.RIGHT;
    }
    return 0;
}
PhotosPanel.java 文件源码 项目:SweetHome3D 阅读 17 收藏 0 点赞 0 评论 0
public void propertyChange(PropertyChangeEvent ev)
{
    // If photo panel was garbage collected, remove this listener from preferences
    PhotosPanel photoPanel = this.photoPanel.get();
    UserPreferences preferences = (UserPreferences) ev.getSource();
    if (photoPanel == null)
    {
        preferences.removePropertyChangeListener(UserPreferences.Property.LANGUAGE, this);
    }
    else
    {
        photoPanel.setComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
        photoPanel.setComponentTexts(preferences);
        photoPanel.setMnemonics(preferences);
    }
}
PhotoSizeAndQualityPanel.java 文件源码 项目:SweetHome3D 阅读 17 收藏 0 点赞 0 评论 0
public void propertyChange(PropertyChangeEvent ev)
{
    // If photo panel was garbage collected, remove this listener from preferences
    PhotoSizeAndQualityPanel photoPanel = this.photoPanel.get();
    UserPreferences preferences = (UserPreferences) ev.getSource();
    if (photoPanel == null)
    {
        preferences.removePropertyChangeListener(UserPreferences.Property.LANGUAGE, this);
    }
    else
    {
        photoPanel.setComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault()));
        photoPanel.setComponentTexts(preferences);
        photoPanel.setMnemonics(preferences);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号