大家好 Stackoverflower! 在 JavaFx 中,TitlePane 是一个很棒的窗格,但是一个问题有很多问题!
我的问题是如何将 TitlePane 与左栏或右栏一起使用? 在一些帖子中,我读到有关将 TitlePane 旋转 270 度!这是工作!但接下来有两个主要问题。
如您所见,右侧面板不会粘在其他面板上,如果我关闭面板,它会飞到左上角(一半会进入退出阶段!)。
那么我能做什么呢?我在这里发布我的代码,看看我的肮脏工作是什么样的。
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane minHeight="600.0" minWidth="900.0" prefHeight="600.0" prefWidth="900.0" styleClass="main-application-screen"
xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="ir.mehritco.megnatis.faststonecapture.gui.MainViewController">
<children>
<MenuBar fx:id="menuBar" prefHeight="32.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0"/>
<AnchorPane layoutX="8.0" layoutY="23.0" prefHeight="377.0" prefWidth="600.0" styleClass="dp-01"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="32.0">
<children>
<VBox AnchorPane.bottomAnchor="8.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="8.0"
AnchorPane.topAnchor="8.0">
<children>
<HBox alignment="BOTTOM_LEFT" VBox.vgrow="ALWAYS">
<children>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
HBox.hgrow="NEVER">
<children>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0"
VBox.vgrow="ALWAYS">
<children>
<AnchorPane HBox.hgrow="ALWAYS">
<children>
<TitledPane alignment="CENTER" rotate="270.0" text="تنظیمات">
<padding>
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0"/>
</padding>
<content>
<AnchorPane fx:id="settingPane"
maxHeight="1.7976931348623157E308"
minHeight="364.0" prefHeight="364.0"
rotate="-270.0">
<children>
<VBox fx:id="internalVboxSettings"
alignment="CENTER" maxWidth="340.0"
minWidth="340.0" prefWidth="340.0"
AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<children>
<HBox maxWidth="340.0" minWidth="340.0"
prefWidth="340.0">
<children>
<Label maxWidth="120.0"
minWidth="120.0"
prefWidth="120.0"
styleClass="text-on-transparent-bg"
text="لیست دوربین ها: "
HBox.hgrow="NEVER"/>
<ComboBox maxWidth="133.0"
minWidth="133.0"
prefWidth="133.0"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets left="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</ComboBox>
<Button maxWidth="54.0"
minWidth="54.0"
mnemonicParsing="false"
prefWidth="54.0"
styleClass="btn-help"
text="راهنما">
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
<HBox.margin>
<Insets left="8.0"/>
</HBox.margin>
</Button>
</children>
</HBox>
<HBox layoutX="10.0" layoutY="10.0"
maxWidth="340.0" minWidth="340.0"
prefWidth="340.0">
<children>
<Label maxWidth="120.0"
minWidth="120.0"
prefWidth="120.0"
styleClass="text-on-transparent-bg"
text="لیست قالب بندی: "
HBox.hgrow="NEVER"/>
<ComboBox maxWidth="133.0"
minWidth="133.0"
prefWidth="133.0"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets left="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</ComboBox>
<Button maxWidth="54.0"
minWidth="54.0"
mnemonicParsing="false"
prefWidth="54.0"
styleClass="btn-help"
text="افزودن">
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
<HBox.margin>
<Insets left="8.0"/>
</HBox.margin>
</Button>
</children>
<VBox.margin>
<Insets top="8.0"/>
</VBox.margin>
</HBox>
<HBox layoutX="10.0" layoutY="43.0"
maxWidth="340.0" minWidth="340.0"
prefWidth="340.0">
<children>
<Label maxWidth="120.0"
minWidth="120.0"
prefWidth="120.0"
styleClass="text-on-transparent-bg"
text="فاصله تا صفحه(CM): "
HBox.hgrow="NEVER"/>
<Spinner editable="true"
maxWidth="133.0"
minWidth="133.0"
prefWidth="133.0"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets left="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</Spinner>
<Button maxWidth="54.0"
minWidth="54.0"
mnemonicParsing="false"
prefWidth="54.0"
styleClass="btn-help"
text="ثبت">
抱歉,限制文本长度迫使我创建新帖子:(代码序列)
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
<HBox.margin>
<Insets left="8.0"/>
</HBox.margin>
</Button>
</children>
<VBox.margin>
<Insets top="8.0"/>
</VBox.margin>
</HBox>
<Separator maxWidth="340.0"
minWidth="340.0"
prefWidth="340.0">
<VBox.margin>
<Insets left="8.0" right="8.0"
top="8.0"/>
</VBox.margin>
</Separator>
<VBox maxWidth="340.0" minWidth="340.0"
prefWidth="340.0">
<VBox.margin>
<Insets top="8.0"/>
</VBox.margin>
<children>
<Label alignment="CENTER"
maxWidth="1.7976931348623157E308"
styleClass="title-text-on-transparent-bg"
text="برش تصویر"/>
<HBox prefHeight="100.0"
prefWidth="200.0">
<VBox.margin>
<Insets top="8.0"/>
</VBox.margin>
<children>
<ToggleButton
maxWidth="1.7976931348623157E308"
mnemonicParsing="false"
prefWidth="50.0"
text="برش دستی تصویر(Ratio)"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets left="8.0"
right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</ToggleButton>
<ToggleButton
maxWidth="1.7976931348623157E308"
mnemonicParsing="false"
prefWidth="50.0"
text="برش هوشمند تصویر"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</ToggleButton>
</children>
</HBox>
</children>
</VBox>
</children>
<padding>
<Insets left="8.0" right="8.0"/>
</padding>
</VBox>
</children>
<opaqueInsets>
<Insets/>
</opaqueInsets>
</AnchorPane>
</content>
</TitledPane>
</children>
<padding>
<Insets right="8.0"/>
</padding>
</AnchorPane>
</children>
</HBox>
</children>
<HBox.margin>
<Insets left="16.0"/>
</HBox.margin>
</VBox>
<TitledPane fx:id="titlePaneCamera" alignment="CENTER"
maxHeight="1.7976931348623157E308" text="تصویربرداری و عکسبرداری"
HBox.hgrow="ALWAYS">
<content>
<StackPane fx:id="videoFrameView" maxHeight="1.7976931348623157E308"
maxWidth="1.7976931348623157E308" nodeOrientation="LEFT_TO_RIGHT">
<children>
<Button fx:id="btnShowCamera" mnemonicParsing="false"
text="مشاهده سالن و اتصال به دوربین"
StackPane.alignment="BOTTOM_CENTER">
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</Button>
<ProgressIndicator fx:id="cameraLoading" visible="false"
StackPane.alignment="CENTER"/>
</children>
</StackPane>
</content>
<padding>
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0"/>
</padding>
</TitledPane>
</children>
</HBox>
<TitledPane alignment="BOTTOM_CENTER" contentDisplay="BOTTOM" prefHeight="196.0"
text="خروجی تصاویر" VBox.vgrow="ALWAYS">
<content>
<StackPane alignment="BOTTOM_CENTER" minHeight="0.0" minWidth="0.0" prefHeight="180.0"
prefWidth="200.0">
<children>
<HBox alignment="CENTER">
<children>
<VBox alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0"
HBox.hgrow="ALWAYS">
<children>
<HBox VBox.vgrow="NEVER">
<children>
<Label maxWidth="132.0" minWidth="132.0"
prefWidth="132.0"
styleClass="text-on-transparent-bg"
text="مسیر ذخیره سازی تصاویر: ">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
</Label>
<TextField fx:id="textFieldFDirectorySaveImages"
alignment="CENTER_RIGHT" editable="false"
maxWidth="1.7976931348623157E308"
minWidth="32.0" prefWidth="32.0"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
</TextField>
<Button fx:id="btnShowDirectorySavedImage"
maxWidth="72.0" minWidth="72.0"
mnemonicParsing="false" prefWidth="72.0"
text="مشاهده">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</Button>
<Button fx:id="btnChangeDirectorySavedImage"
maxWidth="72.0" minWidth="72.0"
mnemonicParsing="false" prefWidth="72.0"
text="تغییر مسیر">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</Button>
</children>
<VBox.margin>
<Insets bottom="8.0" left="8.0" right="8.0"/>
</VBox.margin>
</HBox>
<HBox layoutX="18.0" layoutY="10.0" VBox.vgrow="NEVER">
<children>
<Label maxWidth="132.0" minWidth="132.0"
prefWidth="132.0"
styleClass="text-on-transparent-bg"
text="آخرین تصویر برداری: ">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
</Label>
<TextField fx:id="lastImageTacked"
alignment="CENTER_RIGHT" editable="false"
maxWidth="1.7976931348623157E308"
minWidth="32.0" prefWidth="32.0"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
</TextField>
<Button fx:id="openLastImageTacked" maxWidth="72.0"
minWidth="72.0" mnemonicParsing="false"
prefWidth="72.0" text="اندازه گیری">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</Button>
<Button fx:id="openListImagesInDirectory"
maxWidth="72.0" minWidth="72.0"
mnemonicParsing="false" prefWidth="72.0"
text="لیست">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</Button>
</children>
<VBox.margin>
<Insets left="8.0" right="8.0"/>
</VBox.margin>
</HBox>
<HBox layoutX="18.0" layoutY="43.0" VBox.vgrow="NEVER">
<children>
<Label maxWidth="132.0" minWidth="132.0"
prefWidth="132.0"
styleClass="text-on-transparent-bg"
text="بارکد تصویر جدید: ">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
</Label>
<TextField fx:id="barcodeInput" alignment="CENTER"
maxWidth="1.7976931348623157E308"
minWidth="32.0" prefWidth="32.0"
HBox.hgrow="ALWAYS">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
</TextField>
<ChoiceBox fx:id="listFormatToSave" maxWidth="72.0"
minWidth="72.0" prefWidth="72.0">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</ChoiceBox>
<Button fx:id="tackImage" maxWidth="72.0"
minWidth="72.0" mnemonicParsing="false"
prefWidth="72.0" text="عکسبرداری">
<HBox.margin>
<Insets right="8.0"/>
</HBox.margin>
<cursor>
<Cursor fx:constant="HAND"/>
</cursor>
</Button>
</children>
<padding>
<Insets left="8.0" right="8.0" top="8.0"/>
</padding>
</HBox>
</children>
</VBox>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0"
HBox.hgrow="ALWAYS"/>
</children>
</HBox>
</children>
</StackPane>
</content>
<padding>
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0"/>
</padding>
<VBox.margin>
<Insets/>
</VBox.margin>
</TitledPane>
</children>
</VBox>
</children>
</AnchorPane>
</children>
</AnchorPane>