小编Eng*_*eer的帖子

将光标移动到下一个文本字段按Enter键

我的表单中有多个文本字段,我希望当用户在一个文本字段中输入数据时按Enter键,光标移动到当前文本字段旁边的另一个文本字段.我访问了一些问题,但没有发现它们有用.

$("#username").keypress(function (event) {
    alert("inside function");
    if(event.keyCode == 13) { 
        textboxes = $("input.username");
        debugger;
        currentBoxNumber = textboxes.index(this);
        if (textboxes[currentBoxNumber + 1] != null) {
            nextBox = textboxes[currentBoxNumber + 1];
            nextBox.focus();
            nextBox.select();
            event.preventDefault();
            return false; 
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

这是我的代码,我尝试了另一件事,当在最后一个文本字段中输入数据时,表单将提交鼠标单击按钮而不是输入按.

html javascript jquery

7
推荐指数
1
解决办法
3万
查看次数

如何在Dialog窗口中覆盖primefaces中的主题并设置用户定义CSS

我使用primefaces 3.5,我希望在完成任何操作后显示对话框窗口.对话框应该像这样显示

在此输入图像描述

但我不知道为什么我的主题不起作用我尝试了很多,我有这样的输出 在此输入图像描述

而我的过度骑行就是这个

.ui-widget-content{
    background-color:white;

}
.ui-helper-clearfix:after{
    background-color:green!important;

}
.ui-widget-header{
    background:green!important;

}
.ui-shadow{

    box-shadow:none;
}
.ui-dialog-content{
    background:white!important;

    padding: 0,0,0,0!important;
}
Run Code Online (Sandbox Code Playgroud)

我的xhtml文件代码是这个

<h:form id="form6"> 
                            <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true"  /> 


        <h:button id="button1" onclick="ex.show();return false;" value="Ex alternis sermonibus" actionListener="#{indexBean.addInfo}"/>


        <h:button id="button2"  onclick="radicalis.show();return false;" value="Radicalis alternis sermonibus"/>

    <p:commandButton id="infoButton" value="Info" actionListener="#{indexBean.addInfo}"/>         

</h:form> 
        <h:form id="form1">
            <h:outputText id="hail"/>
        </h:form>

        <h:outputText id="hail-outside" />

        <p:dialog id="dialog1" header="Success" modal="true" resizable="false" style="height: 121px!important;left: 18px!important;width: 295px!important;"   appendToBody="true"  widgetVar="ex"
         styleClass="ui-widget-content ui-helper-clearfix:after ui-widget-header ui-shadow .ui-dialog .ui-dialog-content">
            <h:form id="form2">
                <h:outputText value="You have …
Run Code Online (Sandbox Code Playgroud)

html css primefaces jsf-2

2
推荐指数
1
解决办法
1万
查看次数

如何在JPanel中设置背景图片

您好我使用JPanel作为我的框架的容器然后我真的想在我的面板中使用背景图片我真的需要帮助这是我的代码到目前为止.这是更新,请在这里查看我的代码

 import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class imagebut extends JFrame
{

public static void main(String args [])
{
    imagebut w = new imagebut();
    w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    w.setSize(300,300);
    w.setVisible(true);

}
public imagebut()
{   

    setLayout(null); // :-)
    PicPanel mainPanel = new PicPanel("picturename.jpg");
    mainPanel.setBounds(0,0,500,500);
    add(mainPanel);


}

class PicPanel extends JPanel{

    private BufferedImage image;
    private int w,h;
    public PicPanel(String fname){

        //reads the image
        try {
            image = ImageIO.read(new File(fname));
            w = image.getWidth();
            h = image.getHeight();

        } catch (IOException ioe) {
            System.out.println("Could not read in …
Run Code Online (Sandbox Code Playgroud)

java user-interface swing image jpanel

2
推荐指数
1
解决办法
4万
查看次数

数字太大Java中的异常

我想打印这个整数

 int a=07;
System.out.println("Value of a is "+a);
Run Code Online (Sandbox Code Playgroud)

它运行并显示value of a is 7,但当我改变a的值

 int a=08;
System.out.println("Value of a is "+a);
Run Code Online (Sandbox Code Playgroud)

然后它显示 integer number too large

我不知道为什么......任何人都可以告诉我吗?

java

0
推荐指数
1
解决办法
1349
查看次数

标签 统计

html ×2

java ×2

css ×1

image ×1

javascript ×1

jpanel ×1

jquery ×1

jsf-2 ×1

primefaces ×1

swing ×1

user-interface ×1