2014-11-15 19 views
6

Trong JavaFX Scene Builder có một trường văn bản để tìm kiếm trong thư viện:JavaFX tìm kiếm textfield

enter image description here

này một điều khiển mặc định là (nếu vì vậy tôi không thể tìm thấy nó) hoặc đã làm họ chỉ đơn giản phong cách một trường văn bản?
tôi đã cố gắng tìm kiếm trong mã nguồn của Cảnh Builder là tốt, nhưng không thể tìm thấy nó.

+0

Tôi cũng quan tâm. Bạn đã tìm thấy bất kỳ ví dụ? –

+0

có bất kỳ mã mẫu hoặc hướng dẫn nào không? – Zcon

Trả lời

0

Không có kiểm soát premade để làm việc theo cách này, nhưng bạn có thể tạo một trang bằng sự kiện TextField.

Ví dụ xem mã tiếp theo: AutoComplete ComboBox in JavaFX

0

Chúng tôi có thể làm cho thanh công cụ riêng của chúng tôi like this

<ToolBar prefHeight="40.0" prefWidth="349.0" > 
     <items> 
      <Button fx:id="buttonCloseSearch" styleClass="buttonSearchClose"> 
       <graphic> 
        <FontAwesomeIconView styleClass="buttonSearchCloseIcon" /> 
       </graphic> 
      </Button> 
      <CustomTextField styleClass="searchField"> 
       <left> 
        <Label styleClass="searchBoxLabel"> 
         <graphic> 
          <FontAwesomeIconView styleClass="searchBoxLabelIcon" /> 
         </graphic> 
        </Label> 
       </left> 
      </CustomTextField> 
      <Button fx:id="buttonUpSearch" styleClass="buttonUpSearch"> 
       <graphic> 
        <FontAwesomeIconView styleClass="buttonSearchUpIcon" /> 
       </graphic> 
      </Button> 
      <Button fx:id="buttonDownSearch" styleClass="buttonDownSearch"> 
       <graphic> 
        <FontAwesomeIconView styleClass="buttonSearchDownIcon" /> 
       </graphic> 
      </Button> 
     <Label text="1 of 2 matchs" /> 
     </items> 
    </ToolBar> 

.buttonSearchCloseIcon { 
 
    -glyph-size: 15; 
 
    -glyph-name: CLOSE; 
 
} 
 

 
.buttonSearchUpIcon { 
 
    -glyph-size: 15; 
 
    -glyph-name: CARET_UP; 
 
} 
 

 
.buttonSearchDownIcon { 
 
    -glyph-size: 15; 
 
    -glyph-name: CARET_DOWN; 
 
} 
 

 
.buttonSearchClose, .buttonUpSearch, .buttonDownSearch { 
 
    -fx-background-color: transparent; 
 
    -fx-background-insets: 0; 
 
} 
 

 
.searchBoxLabel { 
 
    -fx-padding: 0 2 0 7; 
 
} 
 

 
.searchBoxLabelIcon { 
 
    -glyph-size: 13; 
 
    -glyph-name: SEARCH; 
 
}

Các vấn đề liên quan